From df746c5ff45490763251693360ba1a847d5861ab Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Thu, 25 Jul 2019 18:30:35 +0200 Subject: [PATCH 01/15] Decode log arguments in `awaitTransactionSuccessAsync`, when ABI is recognized. --- contracts/exchange/test/core.ts | 7 +- contracts/exchange/test/dispatcher.ts | 3 + contracts/exchange/test/internal.ts | 3 + contracts/exchange/test/match_orders.ts | 5 ++ .../exchange/test/signature_validator.ts | 6 ++ contracts/exchange/test/transactions.ts | 5 ++ .../test/utils/dependency_artifacts.ts | 9 ++ .../exchange/test/utils/exchange_wrapper.ts | 86 +++++++------------ .../utils/fill_order_combinatorial_utils.ts | 2 + contracts/exchange/test/wrapper.ts | 4 + .../abi-gen-templates/contract.handlebars | 12 ++- packages/base-contract/src/index.ts | 5 ++ 12 files changed, 87 insertions(+), 60 deletions(-) create mode 100644 contracts/exchange/test/utils/dependency_artifacts.ts diff --git a/contracts/exchange/test/core.ts b/contracts/exchange/test/core.ts index ab77c8eb54..c617db9e39 100644 --- a/contracts/exchange/test/core.ts +++ b/contracts/exchange/test/core.ts @@ -51,6 +51,8 @@ import { TestStaticCallReceiverContract, } from '../src'; +import { dependencyArtifacts } from './utils/dependency_artifacts'; + chaiSetup.configure(); const expect = chai.expect; const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); @@ -136,17 +138,20 @@ describe('Exchange core', () => { artifacts.Exchange, provider, txDefaults, + dependencyArtifacts, assetDataUtils.encodeERC20AssetData(zrxToken.address), ); maliciousWallet = maliciousValidator = await TestStaticCallReceiverContract.deployFrom0xArtifactAsync( artifacts.TestStaticCallReceiver, provider, txDefaults, + dependencyArtifacts, ); reentrantErc20Token = await ReentrantERC20TokenContract.deployFrom0xArtifactAsync( artifacts.ReentrantERC20Token, provider, txDefaults, + dependencyArtifacts, exchange.address, ); @@ -379,7 +384,7 @@ describe('Exchange core', () => { const initialTakerZrxBalance = await zrxToken.balanceOf.callAsync(takerAddress); const initialFeeRecipientZrxBalance = await zrxToken.balanceOf.callAsync(feeRecipientAddress); - await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress); + const txReceipt = await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress); const finalMakerBalanceA = await noReturnErc20Token.balanceOf.callAsync(makerAddress); const finalMakerBalanceB = await erc20TokenB.balanceOf.callAsync(makerAddress); diff --git a/contracts/exchange/test/dispatcher.ts b/contracts/exchange/test/dispatcher.ts index a257559365..08b1aa55a3 100644 --- a/contracts/exchange/test/dispatcher.ts +++ b/contracts/exchange/test/dispatcher.ts @@ -29,6 +29,8 @@ import { TestAssetProxyDispatcherContract, } from '../src'; +import { dependencyArtifacts } from './utils/dependency_artifacts'; + chaiSetup.configure(); const expect = chai.expect; const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); @@ -72,6 +74,7 @@ describe('AssetProxyDispatcher', () => { artifacts.TestAssetProxyDispatcher, provider, txDefaults, + dependencyArtifacts, ); await web3Wrapper.awaitTransactionSuccessAsync( await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcher.address, { diff --git a/contracts/exchange/test/internal.ts b/contracts/exchange/test/internal.ts index 7a1e12a7a1..23ee456d41 100644 --- a/contracts/exchange/test/internal.ts +++ b/contracts/exchange/test/internal.ts @@ -18,6 +18,8 @@ import * as _ from 'lodash'; import { artifacts, TestExchangeInternalsContract } from '../src'; +import { dependencyArtifacts } from './utils/dependency_artifacts'; + chaiSetup.configure(); const expect = chai.expect; @@ -65,6 +67,7 @@ describe('Exchange core internal functions', () => { artifacts.TestExchangeInternals, provider, txDefaults, + dependencyArtifacts, ); overflowErrorForSendTransaction = new Error( await getRevertReasonOrErrorMessageForSendTransactionAsync(RevertReason.Uint256Overflow), diff --git a/contracts/exchange/test/match_orders.ts b/contracts/exchange/test/match_orders.ts index b749805379..05d7a3985b 100644 --- a/contracts/exchange/test/match_orders.ts +++ b/contracts/exchange/test/match_orders.ts @@ -29,6 +29,8 @@ import { TestExchangeInternalsContract, } from '../src'; +import { dependencyArtifacts } from './utils/dependency_artifacts'; + const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); chaiSetup.configure(); const expect = chai.expect; @@ -118,6 +120,7 @@ describe('matchOrders', () => { artifacts.Exchange, provider, txDefaults, + dependencyArtifacts, assetDataUtils.encodeERC20AssetData(zrxToken.address), ); exchangeWrapper = new ExchangeWrapper(exchange, provider); @@ -141,6 +144,7 @@ describe('matchOrders', () => { artifacts.ReentrantERC20Token, provider, txDefaults, + dependencyArtifacts, exchange.address, ); @@ -175,6 +179,7 @@ describe('matchOrders', () => { artifacts.TestExchangeInternals, provider, txDefaults, + dependencyArtifacts, ); }); beforeEach(async () => { diff --git a/contracts/exchange/test/signature_validator.ts b/contracts/exchange/test/signature_validator.ts index 33510e50c0..df41d2952f 100644 --- a/contracts/exchange/test/signature_validator.ts +++ b/contracts/exchange/test/signature_validator.ts @@ -25,6 +25,8 @@ import { WalletContract, } from '../src'; +import { dependencyArtifacts } from './utils/dependency_artifacts'; + chaiSetup.configure(); const expect = chai.expect; @@ -59,23 +61,27 @@ describe('MixinSignatureValidator', () => { artifacts.TestSignatureValidator, provider, txDefaults, + dependencyArtifacts, ); testWallet = await WalletContract.deployFrom0xArtifactAsync( artifacts.Wallet, provider, txDefaults, + dependencyArtifacts, signerAddress, ); testValidator = await ValidatorContract.deployFrom0xArtifactAsync( artifacts.Validator, provider, txDefaults, + dependencyArtifacts, signerAddress, ); maliciousWallet = maliciousValidator = await TestStaticCallReceiverContract.deployFrom0xArtifactAsync( artifacts.TestStaticCallReceiver, provider, txDefaults, + dependencyArtifacts, ); signatureValidatorLogDecoder = new LogDecoder(web3Wrapper, artifacts); await web3Wrapper.awaitTransactionSuccessAsync( diff --git a/contracts/exchange/test/transactions.ts b/contracts/exchange/test/transactions.ts index 4f8c075794..ee1b92ee74 100644 --- a/contracts/exchange/test/transactions.ts +++ b/contracts/exchange/test/transactions.ts @@ -21,6 +21,8 @@ import * as _ from 'lodash'; import { artifacts, ExchangeContract, ExchangeWrapper, ExchangeWrapperContract, WhitelistContract } from '../src/'; +import { dependencyArtifacts } from './utils/dependency_artifacts'; + chaiSetup.configure(); const expect = chai.expect; const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); @@ -87,6 +89,7 @@ describe('Exchange transactions', () => { artifacts.Exchange, provider, txDefaults, + dependencyArtifacts, assetDataUtils.encodeERC20AssetData(zrxToken.address), ); exchangeWrapper = new ExchangeWrapper(exchange, provider); @@ -219,6 +222,7 @@ describe('Exchange transactions', () => { artifacts.ExchangeWrapper, provider, txDefaults, + dependencyArtifacts, exchange.address, ); }); @@ -333,6 +337,7 @@ describe('Exchange transactions', () => { artifacts.Whitelist, provider, txDefaults, + dependencyArtifacts, exchange.address, ); const isApproved = true; diff --git a/contracts/exchange/test/utils/dependency_artifacts.ts b/contracts/exchange/test/utils/dependency_artifacts.ts new file mode 100644 index 0000000000..047e7c8eff --- /dev/null +++ b/contracts/exchange/test/utils/dependency_artifacts.ts @@ -0,0 +1,9 @@ +import { artifacts as erc1155Artifacts } from '@0x/contracts-erc1155'; +import { artifacts as erc20Artifacts } from '@0x/contracts-erc20'; +import { artifacts as erc721Artifacts } from '@0x/contracts-erc721'; + +export const dependencyArtifacts = { + ...erc20Artifacts, + ...erc721Artifacts, + ...erc1155Artifacts, +}; \ No newline at end of file diff --git a/contracts/exchange/test/utils/exchange_wrapper.ts b/contracts/exchange/test/utils/exchange_wrapper.ts index a06e35a462..f9bd120320 100644 --- a/contracts/exchange/test/utils/exchange_wrapper.ts +++ b/contracts/exchange/test/utils/exchange_wrapper.ts @@ -4,7 +4,6 @@ import { artifacts as erc721Artifacts } from '@0x/contracts-erc721'; import { FillResults, formatters, - LogDecoder, OrderInfo, orderUtils, Web3ProviderEngine, @@ -22,16 +21,9 @@ import { AbiDecodedFillOrderData } from './types'; export class ExchangeWrapper { private readonly _exchange: ExchangeContract; private readonly _web3Wrapper: Web3Wrapper; - private readonly _logDecoder: LogDecoder; constructor(exchangeContract: ExchangeContract, provider: Web3ProviderEngine | ZeroExProvider) { this._exchange = exchangeContract; this._web3Wrapper = new Web3Wrapper(provider); - this._logDecoder = new LogDecoder(this._web3Wrapper, { - ...artifacts, - ...erc20Artifacts, - ...erc721Artifacts, - ...erc1155Artifacts, - }); } public async fillOrderAsync( signedOrder: SignedOrder, @@ -39,20 +31,18 @@ export class ExchangeWrapper { opts: { takerAssetFillAmount?: BigNumber } = {}, ): Promise { const params = orderUtils.createFill(signedOrder, opts.takerAssetFillAmount); - const txHash = await this._exchange.fillOrder.sendTransactionAsync( + const txReceipt = await this._exchange.fillOrder.awaitTransactionSuccessAsync( params.order, params.takerAssetFillAmount, params.signature, { from }, ); - const txReceipt = await this._logDecoder.getTxWithDecodedLogsAsync(txHash); return txReceipt; } public async cancelOrderAsync(signedOrder: SignedOrder, from: string): Promise { const params = orderUtils.createCancel(signedOrder); - const txHash = await this._exchange.cancelOrder.sendTransactionAsync(params.order, { from }); - const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash); - return tx; + const txReceipt = await this._exchange.cancelOrder.awaitTransactionSuccessAsync(params.order, { from }); + return txReceipt; } public async fillOrKillOrderAsync( signedOrder: SignedOrder, @@ -60,14 +50,13 @@ export class ExchangeWrapper { opts: { takerAssetFillAmount?: BigNumber } = {}, ): Promise { const params = orderUtils.createFill(signedOrder, opts.takerAssetFillAmount); - const txHash = await this._exchange.fillOrKillOrder.sendTransactionAsync( + const txReceipt = await this._exchange.fillOrKillOrder.awaitTransactionSuccessAsync( params.order, params.takerAssetFillAmount, params.signature, { from }, ); - const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash); - return tx; + return txReceipt; } public async fillOrderNoThrowAsync( signedOrder: SignedOrder, @@ -75,14 +64,13 @@ export class ExchangeWrapper { opts: { takerAssetFillAmount?: BigNumber; gas?: number } = {}, ): Promise { const params = orderUtils.createFill(signedOrder, opts.takerAssetFillAmount); - const txHash = await this._exchange.fillOrderNoThrow.sendTransactionAsync( + const txReceipt = await this._exchange.fillOrderNoThrow.awaitTransactionSuccessAsync( params.order, params.takerAssetFillAmount, params.signature, { from, gas: opts.gas }, ); - const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash); - return tx; + return txReceipt; } public async batchFillOrdersAsync( orders: SignedOrder[], @@ -90,14 +78,13 @@ export class ExchangeWrapper { opts: { takerAssetFillAmounts?: BigNumber[] } = {}, ): Promise { const params = formatters.createBatchFill(orders, opts.takerAssetFillAmounts); - const txHash = await this._exchange.batchFillOrders.sendTransactionAsync( + const txReceipt = await this._exchange.batchFillOrders.awaitTransactionSuccessAsync( params.orders, params.takerAssetFillAmounts, params.signatures, { from }, ); - const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash); - return tx; + return txReceipt; } public async batchFillOrKillOrdersAsync( orders: SignedOrder[], @@ -105,14 +92,13 @@ export class ExchangeWrapper { opts: { takerAssetFillAmounts?: BigNumber[] } = {}, ): Promise { const params = formatters.createBatchFill(orders, opts.takerAssetFillAmounts); - const txHash = await this._exchange.batchFillOrKillOrders.sendTransactionAsync( + const txReceipt = await this._exchange.batchFillOrKillOrders.awaitTransactionSuccessAsync( params.orders, params.takerAssetFillAmounts, params.signatures, { from }, ); - const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash); - return tx; + return txReceipt; } public async batchFillOrdersNoThrowAsync( orders: SignedOrder[], @@ -120,14 +106,13 @@ export class ExchangeWrapper { opts: { takerAssetFillAmounts?: BigNumber[]; gas?: number } = {}, ): Promise { const params = formatters.createBatchFill(orders, opts.takerAssetFillAmounts); - const txHash = await this._exchange.batchFillOrdersNoThrow.sendTransactionAsync( + const txReceipt = await this._exchange.batchFillOrdersNoThrow.awaitTransactionSuccessAsync( params.orders, params.takerAssetFillAmounts, params.signatures, { from, gas: opts.gas }, ); - const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash); - return tx; + return txReceipt; } public async marketSellOrdersAsync( orders: SignedOrder[], @@ -135,14 +120,13 @@ export class ExchangeWrapper { opts: { takerAssetFillAmount: BigNumber }, ): Promise { const params = formatters.createMarketSellOrders(orders, opts.takerAssetFillAmount); - const txHash = await this._exchange.marketSellOrders.sendTransactionAsync( + const txReceipt = await this._exchange.marketSellOrders.awaitTransactionSuccessAsync( params.orders, params.takerAssetFillAmount, params.signatures, { from }, ); - const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash); - return tx; + return txReceipt; } public async marketSellOrdersNoThrowAsync( orders: SignedOrder[], @@ -150,14 +134,13 @@ export class ExchangeWrapper { opts: { takerAssetFillAmount: BigNumber; gas?: number }, ): Promise { const params = formatters.createMarketSellOrders(orders, opts.takerAssetFillAmount); - const txHash = await this._exchange.marketSellOrdersNoThrow.sendTransactionAsync( + const txReceipt = await this._exchange.marketSellOrdersNoThrow.awaitTransactionSuccessAsync( params.orders, params.takerAssetFillAmount, params.signatures, { from, gas: opts.gas }, ); - const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash); - return tx; + return txReceipt; } public async marketBuyOrdersAsync( orders: SignedOrder[], @@ -165,14 +148,13 @@ export class ExchangeWrapper { opts: { makerAssetFillAmount: BigNumber }, ): Promise { const params = formatters.createMarketBuyOrders(orders, opts.makerAssetFillAmount); - const txHash = await this._exchange.marketBuyOrders.sendTransactionAsync( + const txReceipt = await this._exchange.marketBuyOrders.awaitTransactionSuccessAsync( params.orders, params.makerAssetFillAmount, params.signatures, { from }, ); - const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash); - return tx; + return txReceipt; } public async marketBuyOrdersNoThrowAsync( orders: SignedOrder[], @@ -180,50 +162,45 @@ export class ExchangeWrapper { opts: { makerAssetFillAmount: BigNumber; gas?: number }, ): Promise { const params = formatters.createMarketBuyOrders(orders, opts.makerAssetFillAmount); - const txHash = await this._exchange.marketBuyOrdersNoThrow.sendTransactionAsync( + const txReceipt = await this._exchange.marketBuyOrdersNoThrow.awaitTransactionSuccessAsync( params.orders, params.makerAssetFillAmount, params.signatures, { from, gas: opts.gas }, ); - const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash); - return tx; + return txReceipt; } public async batchCancelOrdersAsync( orders: SignedOrder[], from: string, ): Promise { const params = formatters.createBatchCancel(orders); - const txHash = await this._exchange.batchCancelOrders.sendTransactionAsync(params.orders, { from }); - const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash); - return tx; + const txReceipt = await this._exchange.batchCancelOrders.awaitTransactionSuccessAsync(params.orders, { from }); + return txReceipt; } public async cancelOrdersUpToAsync(salt: BigNumber, from: string): Promise { - const txHash = await this._exchange.cancelOrdersUpTo.sendTransactionAsync(salt, { from }); - const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash); - return tx; + const txReceipt = await this._exchange.cancelOrdersUpTo.awaitTransactionSuccessAsync(salt, { from }); + return txReceipt; } public async registerAssetProxyAsync( assetProxyAddress: string, from: string, ): Promise { - const txHash = await this._exchange.registerAssetProxy.sendTransactionAsync(assetProxyAddress, { from }); - const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash); - return tx; + const txReceipt = await this._exchange.registerAssetProxy.awaitTransactionSuccessAsync(assetProxyAddress, { from }); + return txReceipt; } public async executeTransactionAsync( signedTx: SignedZeroExTransaction, from: string, ): Promise { - const txHash = await this._exchange.executeTransaction.sendTransactionAsync( + const txReceipt = await this._exchange.executeTransaction.awaitTransactionSuccessAsync( signedTx.salt, signedTx.signerAddress, signedTx.data, signedTx.signature, { from }, ); - const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash); - return tx; + return txReceipt; } public async getTakerAssetFilledAmountAsync(orderHashHex: string): Promise { const filledAmount = await this._exchange.filled.callAsync(orderHashHex); @@ -251,15 +228,14 @@ export class ExchangeWrapper { from: string, ): Promise { const params = orderUtils.createMatchOrders(signedOrderLeft, signedOrderRight); - const txHash = await this._exchange.matchOrders.sendTransactionAsync( + const txReceipt = await this._exchange.matchOrders.awaitTransactionSuccessAsync( params.left, params.right, params.leftSignature, params.rightSignature, { from }, ); - const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash); - return tx; + return txReceipt; } public async getFillOrderResultsAsync( signedOrder: SignedOrder, diff --git a/contracts/exchange/test/utils/fill_order_combinatorial_utils.ts b/contracts/exchange/test/utils/fill_order_combinatorial_utils.ts index a15b27e12b..a42511ad3a 100644 --- a/contracts/exchange/test/utils/fill_order_combinatorial_utils.ts +++ b/contracts/exchange/test/utils/fill_order_combinatorial_utils.ts @@ -37,6 +37,7 @@ import 'make-promises-safe'; import { artifacts, ExchangeContract, ExchangeFillEventArgs } from '../../src'; import { AssetWrapper } from './asset_wrapper'; +import { dependencyArtifacts } from './dependency_artifacts'; import { ExchangeWrapper } from './exchange_wrapper'; import { OrderFactoryFromScenario } from './order_factory_from_scenario'; import { SimpleAssetBalanceAndProxyAllowanceFetcher } from './simple_asset_balance_and_proxy_allowance_fetcher'; @@ -101,6 +102,7 @@ export async function fillOrderCombinatorialUtilsFactoryAsync( artifacts.Exchange, provider, txDefaults, + dependencyArtifacts, zrxAssetData, ); const exchangeWrapper = new ExchangeWrapper(exchangeContract, provider); diff --git a/contracts/exchange/test/wrapper.ts b/contracts/exchange/test/wrapper.ts index 573591b1b5..ab2af0cc76 100644 --- a/contracts/exchange/test/wrapper.ts +++ b/contracts/exchange/test/wrapper.ts @@ -24,6 +24,8 @@ import * as _ from 'lodash'; import { artifacts, ExchangeContract, ExchangeWrapper, ReentrantERC20TokenContract } from '../src'; +import { dependencyArtifacts } from './utils/dependency_artifacts'; + chaiSetup.configure(); const expect = chai.expect; const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); @@ -87,6 +89,7 @@ describe('Exchange wrappers', () => { artifacts.Exchange, provider, txDefaults, + dependencyArtifacts, assetDataUtils.encodeERC20AssetData(zrxToken.address), ); exchangeWrapper = new ExchangeWrapper(exchange, provider); @@ -110,6 +113,7 @@ describe('Exchange wrappers', () => { artifacts.ReentrantERC20Token, provider, txDefaults, + dependencyArtifacts, exchange.address, ); diff --git a/packages/abi-gen-templates/contract.handlebars b/packages/abi-gen-templates/contract.handlebars index 78c5e47d89..61375cb0a0 100644 --- a/packages/abi-gen-templates/contract.handlebars +++ b/packages/abi-gen-templates/contract.handlebars @@ -26,6 +26,7 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; +import * as _ from 'lodash'; // tslint:enable:no-unused-variable {{#if events}} @@ -63,6 +64,7 @@ export class {{contractName}}Contract extends BaseContract { artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, + artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, {{> typed_params inputs=ctor.inputs}} ): Promise<{{contractName}}Contract> { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -76,13 +78,15 @@ export class {{contractName}}Contract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - return {{contractName}}Contract.deployAsync(bytecode, abi, provider, txDefaults, {{> params inputs=ctor.inputs}}); + const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); + return {{contractName}}Contract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, {{> params inputs=ctor.inputs}}); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, + abiDependencies: { [contractName: string]: ContractAbi }, {{> typed_params inputs=ctor.inputs}} ): Promise<{{contractName}}Contract> { assert.isHexString('bytecode', bytecode); @@ -111,7 +115,7 @@ export class {{contractName}}Contract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`{{contractName}} successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new {{contractName}}Contract(txReceipt.contractAddress as string, provider, txDefaults); + const contractInstance = new {{contractName}}Contract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); contractInstance.constructorArgs = [{{> params inputs=ctor.inputs}}]; return contractInstance; } @@ -213,8 +217,8 @@ export class {{contractName}}Contract extends BaseContract { ); return logs; }{{/if}} - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial) { - super('{{contractName}}', {{contractName}}Contract.ABI(), address, supportedProvider, txDefaults); + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + super('{{contractName}}', {{contractName}}Contract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']);{{#if events}} this._subscriptionManager = new SubscriptionManager<{{contractName}}EventArgs, {{contractName}}Events>( {{contractName}}Contract.ABI(), diff --git a/packages/base-contract/src/index.ts b/packages/base-contract/src/index.ts index cf7dffede3..1e79cae696 100644 --- a/packages/base-contract/src/index.ts +++ b/packages/base-contract/src/index.ts @@ -186,6 +186,7 @@ export class BaseContract { address: string, supportedProvider: SupportedProvider, callAndTxnDefaults?: Partial, + abiDependencies?: { [contractName: string]: ContractAbi }, ) { assert.isString('contractName', contractName); assert.isETHAddressHex('address', address); @@ -209,6 +210,10 @@ export class BaseContract { const abiEncoder = new AbiEncoder.Method(methodAbi); const functionSignature = abiEncoder.getSignature(); this._abiEncoderByFunctionSignature[functionSignature] = abiEncoder; + this._web3Wrapper.abiDecoder.addABI(abi, contractName); + }); + _.each(abiDependencies, (abi, name) => { + this._web3Wrapper.abiDecoder.addABI(abi, name); }); } } From d8cf9d54aa96ddac5f3f2ba7cc61c51fee36f315 Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Fri, 26 Jul 2019 17:51:52 +0200 Subject: [PATCH 02/15] Updated all instances of `deployFrom0xArtifactAsync` --- contracts/asset-proxy/test/authorizable.ts | 1 + contracts/asset-proxy/test/erc1155_proxy.ts | 3 +- contracts/asset-proxy/test/proxies.ts | 4 + .../asset-proxy/test/static_call_proxy.ts | 2 + .../test/utils/erc1155_proxy_wrapper.ts | 2 + .../asset-proxy/test/utils/erc20_wrapper.ts | 2 + .../asset-proxy/test/utils/erc721_wrapper.ts | 2 + contracts/coordinator/test/coordinator.ts | 2 + contracts/coordinator/test/libs.ts | 1 + contracts/coordinator/test/mixins.ts | 1 + .../utils/coordinator_registry_wrapper.ts | 1 + contracts/dev-utils/test/lib_asset_data.ts | 11 + .../dev-utils/test/lib_transaction_decoder.ts | 1 + .../dev-utils/test/order_validation_utils.ts | 3 + contracts/erc1155/test/erc1155_token.ts | 2 + .../erc20/test/unlimited_allowance_token.ts | 1 + contracts/erc20/test/weth9.ts | 13 +- contracts/erc20/test/zrx_token.ts | 7 +- contracts/erc721/test/erc721_token.ts | 6 + .../exchange-forwarder/test/forwarder.ts | 12 +- contracts/exchange-libs/test/exchange_libs.ts | 2 +- contracts/exchange/test/core.ts | 6 +- contracts/exchange/test/dispatcher.ts | 1 + .../test/utils/dependency_artifacts.ts | 2 +- .../exchange/test/utils/exchange_wrapper.ts | 18 +- .../utils/fill_order_combinatorial_utils.ts | 1 + .../test/balance_threshold_filter.ts | 3 + contracts/extensions/test/dutch_auction.ts | 4 +- contracts/extensions/test/order_matcher.ts | 8 + contracts/multisig/test/asset_proxy_owner.ts | 5 + .../multisig/test/multi_sig_with_time_lock.ts | 6 + contracts/utils/test/lib_address_array.ts | 1 + contracts/utils/test/lib_bytes.ts | 7 +- contracts/utils/test/libs.ts | 1 + .../generated-wrappers/asset_proxy_owner.ts | 2336 ++++---- .../src/generated-wrappers/coordinator.ts | 610 +- .../coordinator_registry.ts | 234 +- .../generated-wrappers/dummy_erc20_token.ts | 1278 ++-- .../generated-wrappers/dummy_erc721_token.ts | 1622 +++--- .../src/generated-wrappers/dutch_auction.ts | 664 +-- .../src/generated-wrappers/erc20_proxy.ts | 809 +-- .../src/generated-wrappers/erc20_token.ts | 631 +- .../src/generated-wrappers/erc721_proxy.ts | 809 +-- .../src/generated-wrappers/erc721_token.ts | 1055 ++-- .../generated-wrappers/eth_balance_checker.ts | 60 +- .../src/generated-wrappers/exchange.ts | 5174 +++++++---------- .../src/generated-wrappers/forwarder.ts | 1293 ++-- .../src/generated-wrappers/i_asset_proxy.ts | 893 +-- .../src/generated-wrappers/i_validator.ts | 70 +- .../src/generated-wrappers/i_wallet.ts | 62 +- .../generated-wrappers/multi_asset_proxy.ts | 1021 ++-- .../src/generated-wrappers/order_validator.ts | 558 +- .../src/generated-wrappers/weth9.ts | 1016 ++-- .../src/generated-wrappers/zrx_token.ts | 720 +-- .../test/abi_gen_dummy_test.ts | 14 +- packages/base-contract/src/index.ts | 4 +- .../test/exchange_wrapper_test.ts | 2 + packages/migrations/src/migration.ts | 20 +- .../test/exchange_transfer_simulator_test.ts | 2 + 59 files changed, 10377 insertions(+), 10722 deletions(-) diff --git a/contracts/asset-proxy/test/authorizable.ts b/contracts/asset-proxy/test/authorizable.ts index ccceb0862a..d86c5d9579 100644 --- a/contracts/asset-proxy/test/authorizable.ts +++ b/contracts/asset-proxy/test/authorizable.ts @@ -37,6 +37,7 @@ describe('Authorizable', () => { artifacts.MixinAuthorizable, provider, txDefaults, + artifacts, ); }); beforeEach(async () => { diff --git a/contracts/asset-proxy/test/erc1155_proxy.ts b/contracts/asset-proxy/test/erc1155_proxy.ts index 5048af635c..4e1730af32 100644 --- a/contracts/asset-proxy/test/erc1155_proxy.ts +++ b/contracts/asset-proxy/test/erc1155_proxy.ts @@ -23,7 +23,7 @@ import { LogWithDecodedArgs } from 'ethereum-types'; import * as ethUtil from 'ethereumjs-util'; import * as _ from 'lodash'; -import { ERC1155ProxyContract, ERC1155ProxyWrapper } from '../src'; +import { artifacts, ERC1155ProxyContract, ERC1155ProxyWrapper } from '../src'; chaiSetup.configure(); const expect = chai.expect; @@ -89,6 +89,7 @@ describe('ERC1155Proxy', () => { erc1155Artifacts.DummyERC1155Receiver, provider, txDefaults, + artifacts, ); receiverContract = erc1155Receiver.address; await erc1155ProxyWrapper.setBalancesAndAllowancesAsync(); diff --git a/contracts/asset-proxy/test/proxies.ts b/contracts/asset-proxy/test/proxies.ts index f6c21e7699..aba9e08071 100644 --- a/contracts/asset-proxy/test/proxies.ts +++ b/contracts/asset-proxy/test/proxies.ts @@ -101,6 +101,7 @@ describe('Asset Transfer Proxies', () => { artifacts.MultiAssetProxy, provider, txDefaults, + artifacts, ); // Configure ERC20Proxy @@ -173,6 +174,7 @@ describe('Asset Transfer Proxies', () => { erc20Artifacts.DummyNoReturnERC20Token, provider, txDefaults, + artifacts, constants.DUMMY_TOKEN_NAME, constants.DUMMY_TOKEN_SYMBOL, constants.DUMMY_TOKEN_DECIMALS, @@ -182,6 +184,7 @@ describe('Asset Transfer Proxies', () => { erc20Artifacts.DummyMultipleReturnERC20Token, provider, txDefaults, + artifacts, constants.DUMMY_TOKEN_NAME, constants.DUMMY_TOKEN_SYMBOL, constants.DUMMY_TOKEN_DECIMALS, @@ -224,6 +227,7 @@ describe('Asset Transfer Proxies', () => { erc721Artifacts.DummyERC721Receiver, provider, txDefaults, + artifacts, ); await erc721Wrapper.setBalancesAndAllowancesAsync(); diff --git a/contracts/asset-proxy/test/static_call_proxy.ts b/contracts/asset-proxy/test/static_call_proxy.ts index 36f38785a2..a1cf95a4d3 100644 --- a/contracts/asset-proxy/test/static_call_proxy.ts +++ b/contracts/asset-proxy/test/static_call_proxy.ts @@ -41,12 +41,14 @@ describe('StaticCallProxy', () => { artifacts.StaticCallProxy, provider, txDefaults, + artifacts, ); staticCallProxy = new IAssetProxyContract(staticCallProxyWithoutTransferFrom.address, provider, txDefaults); staticCallTarget = await TestStaticCallTargetContract.deployFrom0xArtifactAsync( artifacts.TestStaticCallTarget, provider, txDefaults, + artifacts, ); }); beforeEach(async () => { diff --git a/contracts/asset-proxy/test/utils/erc1155_proxy_wrapper.ts b/contracts/asset-proxy/test/utils/erc1155_proxy_wrapper.ts index 294fbada5b..d770027f5c 100644 --- a/contracts/asset-proxy/test/utils/erc1155_proxy_wrapper.ts +++ b/contracts/asset-proxy/test/utils/erc1155_proxy_wrapper.ts @@ -54,6 +54,7 @@ export class ERC1155ProxyWrapper { erc1155Artifacts.ERC1155Mintable, this._provider, txDefaults, + artifacts, ); const erc1155Wrapper = new Erc1155Wrapper(erc1155Contract, this._provider, this._contractOwnerAddress); this._dummyTokenWrappers.push(erc1155Wrapper); @@ -69,6 +70,7 @@ export class ERC1155ProxyWrapper { artifacts.ERC1155Proxy, this._provider, txDefaults, + artifacts, ); this._proxyIdIfExists = await this._proxyContract.getProxyId.callAsync(); return this._proxyContract; diff --git a/contracts/asset-proxy/test/utils/erc20_wrapper.ts b/contracts/asset-proxy/test/utils/erc20_wrapper.ts index 2bb1702222..8fdd210b24 100644 --- a/contracts/asset-proxy/test/utils/erc20_wrapper.ts +++ b/contracts/asset-proxy/test/utils/erc20_wrapper.ts @@ -37,6 +37,7 @@ export class ERC20Wrapper { erc20Artifacts.DummyERC20Token, this._provider, txDefaults, + artifacts, constants.DUMMY_TOKEN_NAME, constants.DUMMY_TOKEN_SYMBOL, decimals, @@ -51,6 +52,7 @@ export class ERC20Wrapper { artifacts.ERC20Proxy, this._provider, txDefaults, + artifacts, ); this._proxyIdIfExists = await this._proxyContract.getProxyId.callAsync(); return this._proxyContract; diff --git a/contracts/asset-proxy/test/utils/erc721_wrapper.ts b/contracts/asset-proxy/test/utils/erc721_wrapper.ts index b52d54d7d7..4f34db29d3 100644 --- a/contracts/asset-proxy/test/utils/erc721_wrapper.ts +++ b/contracts/asset-proxy/test/utils/erc721_wrapper.ts @@ -29,6 +29,7 @@ export class ERC721Wrapper { erc721Artifacts.DummyERC721Token, this._provider, txDefaults, + artifacts, constants.DUMMY_TOKEN_NAME, constants.DUMMY_TOKEN_SYMBOL, ), @@ -41,6 +42,7 @@ export class ERC721Wrapper { artifacts.ERC721Proxy, this._provider, txDefaults, + artifacts, ); this._proxyIdIfExists = await this._proxyContract.getProxyId.callAsync(); return this._proxyContract; diff --git a/contracts/coordinator/test/coordinator.ts b/contracts/coordinator/test/coordinator.ts index 912d48d922..a76fa574f5 100644 --- a/contracts/coordinator/test/coordinator.ts +++ b/contracts/coordinator/test/coordinator.ts @@ -74,6 +74,7 @@ describe('Coordinator tests', () => { exchangeArtifacts.Exchange, provider, txDefaults, + artifacts, assetDataUtils.encodeERC20AssetData(zrxToken.address), ); @@ -91,6 +92,7 @@ describe('Coordinator tests', () => { artifacts.Coordinator, provider, txDefaults, + artifacts, exchange.address, ); diff --git a/contracts/coordinator/test/libs.ts b/contracts/coordinator/test/libs.ts index 8c08f0ec59..df1dbbf8c3 100644 --- a/contracts/coordinator/test/libs.ts +++ b/contracts/coordinator/test/libs.ts @@ -25,6 +25,7 @@ describe('Libs tests', () => { artifacts.Coordinator, provider, txDefaults, + artifacts, exchangeAddress, ); }); diff --git a/contracts/coordinator/test/mixins.ts b/contracts/coordinator/test/mixins.ts index a500333048..9ccf2d28f8 100644 --- a/contracts/coordinator/test/mixins.ts +++ b/contracts/coordinator/test/mixins.ts @@ -44,6 +44,7 @@ describe('Mixins tests', () => { artifacts.Coordinator, provider, txDefaults, + artifacts, exchangeAddress, ); const accounts = await web3Wrapper.getAvailableAddressesAsync(); diff --git a/contracts/coordinator/test/utils/coordinator_registry_wrapper.ts b/contracts/coordinator/test/utils/coordinator_registry_wrapper.ts index 3c80714225..3d7a2999ef 100644 --- a/contracts/coordinator/test/utils/coordinator_registry_wrapper.ts +++ b/contracts/coordinator/test/utils/coordinator_registry_wrapper.ts @@ -24,6 +24,7 @@ export class CoordinatorRegistryWrapper { artifacts.CoordinatorRegistry, this._provider, txDefaults, + artifacts, ); if (this._coordinatorRegistryContract === undefined) { throw new Error(`Failed to deploy Coordinator Registry contract.`); diff --git a/contracts/dev-utils/test/lib_asset_data.ts b/contracts/dev-utils/test/lib_asset_data.ts index 0276fb5f75..7c7d0deb6f 100644 --- a/contracts/dev-utils/test/lib_asset_data.ts +++ b/contracts/dev-utils/test/lib_asset_data.ts @@ -92,6 +92,7 @@ describe('LibAssetData', () => { exchangeArtifacts.Exchange, provider, txDefaults, + artifacts, constants.NULL_BYTES, ); @@ -99,26 +100,31 @@ describe('LibAssetData', () => { proxyArtifacts.ERC20Proxy, provider, txDefaults, + artifacts, ); erc721Proxy = await ERC721ProxyContract.deployFrom0xArtifactAsync( proxyArtifacts.ERC721Proxy, provider, txDefaults, + artifacts, ); erc1155Proxy = await ERC1155ProxyContract.deployFrom0xArtifactAsync( proxyArtifacts.ERC1155Proxy, provider, txDefaults, + artifacts, ); multiAssetProxy = await MultiAssetProxyContract.deployFrom0xArtifactAsync( proxyArtifacts.MultiAssetProxy, provider, txDefaults, + artifacts, ); staticCallProxy = await StaticCallProxyContract.deployFrom0xArtifactAsync( proxyArtifacts.StaticCallProxy, provider, txDefaults, + artifacts, ); await exchange.registerAssetProxy.awaitTransactionSuccessAsync(erc20Proxy.address); @@ -131,6 +137,7 @@ describe('LibAssetData', () => { artifacts.LibAssetData, provider, txDefaults, + artifacts, exchange.address, ); @@ -138,6 +145,7 @@ describe('LibAssetData', () => { proxyArtifacts.TestStaticCallTarget, provider, txDefaults, + artifacts, ); [tokenOwnerAddress] = await web3Wrapper.getAvailableAddressesAsync(); @@ -146,6 +154,7 @@ describe('LibAssetData', () => { erc20Artifacts.DummyERC20Token, provider, txDefaults, + artifacts, 'Dummy', 'DUM', new BigNumber(1), @@ -156,6 +165,7 @@ describe('LibAssetData', () => { erc721Artifacts.DummyERC721Token, provider, txDefaults, + artifacts, 'Dummy', 'DUM', ); @@ -172,6 +182,7 @@ describe('LibAssetData', () => { erc1155Artifacts.ERC1155Mintable, provider, txDefaults, + artifacts, ); const logDecoder = new LogDecoder(web3Wrapper, erc1155Artifacts); diff --git a/contracts/dev-utils/test/lib_transaction_decoder.ts b/contracts/dev-utils/test/lib_transaction_decoder.ts index 3719574aa3..9cde98881a 100644 --- a/contracts/dev-utils/test/lib_transaction_decoder.ts +++ b/contracts/dev-utils/test/lib_transaction_decoder.ts @@ -37,6 +37,7 @@ describe('LibTransactionDecoder', () => { artifacts.LibTransactionDecoder, provider, txDefaults, + artifacts, ); }); after(async () => { diff --git a/contracts/dev-utils/test/order_validation_utils.ts b/contracts/dev-utils/test/order_validation_utils.ts index d03cefc18e..28ac3196a0 100644 --- a/contracts/dev-utils/test/order_validation_utils.ts +++ b/contracts/dev-utils/test/order_validation_utils.ts @@ -83,6 +83,7 @@ describe('OrderValidationUtils', () => { exchangeArtifacts.Exchange, provider, txDefaults, + artifacts, zrxAssetData, ); @@ -90,6 +91,7 @@ describe('OrderValidationUtils', () => { proxyArtifacts.MultiAssetProxy, provider, txDefaults, + artifacts, ); const exchangeWrapper = new ExchangeWrapper(exchange, provider); await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, owner); @@ -102,6 +104,7 @@ describe('OrderValidationUtils', () => { artifacts.DevUtils, provider, txDefaults, + artifacts, exchange.address, zrxAssetData, ); diff --git a/contracts/erc1155/test/erc1155_token.ts b/contracts/erc1155/test/erc1155_token.ts index d948c6c86c..858eb17548 100644 --- a/contracts/erc1155/test/erc1155_token.ts +++ b/contracts/erc1155/test/erc1155_token.ts @@ -60,11 +60,13 @@ describe('ERC1155Token', () => { artifacts.ERC1155Mintable, provider, txDefaults, + artifacts, ); erc1155Receiver = await DummyERC1155ReceiverContract.deployFrom0xArtifactAsync( artifacts.DummyERC1155Receiver, provider, txDefaults, + artifacts, ); receiver = erc1155Receiver.address; // create wrapper & mint erc1155 tokens diff --git a/contracts/erc20/test/unlimited_allowance_token.ts b/contracts/erc20/test/unlimited_allowance_token.ts index f0b8e53a46..b9d4bd4296 100644 --- a/contracts/erc20/test/unlimited_allowance_token.ts +++ b/contracts/erc20/test/unlimited_allowance_token.ts @@ -37,6 +37,7 @@ describe('UnlimitedAllowanceToken', () => { artifacts.DummyERC20Token, provider, txDefaults, + artifacts, constants.DUMMY_TOKEN_NAME, constants.DUMMY_TOKEN_SYMBOL, constants.DUMMY_TOKEN_DECIMALS, diff --git a/contracts/erc20/test/weth9.ts b/contracts/erc20/test/weth9.ts index 6a3948e2c3..1fc73e5294 100644 --- a/contracts/erc20/test/weth9.ts +++ b/contracts/erc20/test/weth9.ts @@ -33,10 +33,15 @@ describe('EtherToken', () => { const accounts = await web3Wrapper.getAvailableAddressesAsync(); account = accounts[0]; - etherToken = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.WETH9, provider, { - gasPrice, - ...txDefaults, - }); + etherToken = await WETH9Contract.deployFrom0xArtifactAsync( + artifacts.WETH9, + provider, + { + gasPrice, + ...txDefaults, + }, + artifacts, + ); }); beforeEach(async () => { await blockchainLifecycle.startAsync(); diff --git a/contracts/erc20/test/zrx_token.ts b/contracts/erc20/test/zrx_token.ts index 820b054e6b..a148fc0d85 100644 --- a/contracts/erc20/test/zrx_token.ts +++ b/contracts/erc20/test/zrx_token.ts @@ -26,7 +26,12 @@ describe('ZRXToken', () => { const accounts = await web3Wrapper.getAvailableAddressesAsync(); owner = accounts[0]; spender = accounts[1]; - zrxToken = await ZRXTokenContract.deployFrom0xArtifactAsync(artifacts.ZRXToken, provider, txDefaults); + zrxToken = await ZRXTokenContract.deployFrom0xArtifactAsync( + artifacts.ZRXToken, + provider, + txDefaults, + artifacts, + ); MAX_UINT = constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS; }); beforeEach(async () => { diff --git a/contracts/erc721/test/erc721_token.ts b/contracts/erc721/test/erc721_token.ts index 13332cd35c..b3c0ba4141 100644 --- a/contracts/erc721/test/erc721_token.ts +++ b/contracts/erc721/test/erc721_token.ts @@ -48,6 +48,7 @@ describe('ERC721Token', () => { artifacts.DummyERC721Token, provider, txDefaults, + artifacts, constants.DUMMY_TOKEN_NAME, constants.DUMMY_TOKEN_SYMBOL, ); @@ -55,6 +56,7 @@ describe('ERC721Token', () => { artifacts.DummyERC721Receiver, provider, txDefaults, + artifacts, ); logDecoder = new LogDecoder(web3Wrapper, artifacts); await web3Wrapper.awaitTransactionSuccessAsync( @@ -176,6 +178,7 @@ describe('ERC721Token', () => { artifacts.DummyERC721Token, provider, txDefaults, + artifacts, constants.DUMMY_TOKEN_NAME, constants.DUMMY_TOKEN_SYMBOL, ); @@ -190,6 +193,7 @@ describe('ERC721Token', () => { artifacts.InvalidERC721Receiver, provider, txDefaults, + artifacts, ); const from = owner; const to = invalidErc721Receiver.address; @@ -237,6 +241,7 @@ describe('ERC721Token', () => { artifacts.DummyERC721Token, provider, txDefaults, + artifacts, constants.DUMMY_TOKEN_NAME, constants.DUMMY_TOKEN_SYMBOL, ); @@ -251,6 +256,7 @@ describe('ERC721Token', () => { artifacts.InvalidERC721Receiver, provider, txDefaults, + artifacts, ); const from = owner; const to = invalidErc721Receiver.address; diff --git a/contracts/exchange-forwarder/test/forwarder.ts b/contracts/exchange-forwarder/test/forwarder.ts index 1c518c141b..7f418c0770 100644 --- a/contracts/exchange-forwarder/test/forwarder.ts +++ b/contracts/exchange-forwarder/test/forwarder.ts @@ -32,6 +32,7 @@ const DECIMALS_DEFAULT = 18; const MAX_WETH_FILL_PERCENTAGE = 95; describe(ContractName.Forwarder, () => { + const dependencyArtifacts = { ...artifacts, ...erc20Artifacts, ...exchangeArtifacts }; let makerAddress: string; let owner: string; let takerAddress: string; @@ -88,7 +89,12 @@ describe(ContractName.Forwarder, () => { const erc721Balances = await erc721Wrapper.getBalancesAsync(); erc721MakerAssetIds = erc721Balances[makerAddress][erc721Token.address]; - wethContract = await WETH9Contract.deployFrom0xArtifactAsync(erc20Artifacts.WETH9, provider, txDefaults); + wethContract = await WETH9Contract.deployFrom0xArtifactAsync( + erc20Artifacts.WETH9, + provider, + txDefaults, + dependencyArtifacts, + ); weth = new DummyERC20TokenContract(wethContract.address, provider); erc20Wrapper.addDummyTokenContract(weth); @@ -98,6 +104,7 @@ describe(ContractName.Forwarder, () => { exchangeArtifacts.Exchange, provider, txDefaults, + dependencyArtifacts, zrxAssetData, ); exchangeWrapper = new ExchangeWrapper(exchangeInstance, provider); @@ -131,6 +138,7 @@ describe(ContractName.Forwarder, () => { artifacts.Forwarder, provider, txDefaults, + dependencyArtifacts, exchangeInstance.address, zrxAssetData, wethAssetData, @@ -169,6 +177,7 @@ describe(ContractName.Forwarder, () => { exchangeArtifacts.Exchange, provider, txDefaults, + dependencyArtifacts, zrxAssetData, ); return expectContractCreationFailedAsync( @@ -176,6 +185,7 @@ describe(ContractName.Forwarder, () => { artifacts.Forwarder, provider, txDefaults, + dependencyArtifacts, exchangeInstance.address, zrxAssetData, wethAssetData, diff --git a/contracts/exchange-libs/test/exchange_libs.ts b/contracts/exchange-libs/test/exchange_libs.ts index b613231895..5716b32f56 100644 --- a/contracts/exchange-libs/test/exchange_libs.ts +++ b/contracts/exchange-libs/test/exchange_libs.ts @@ -35,7 +35,7 @@ describe('Exchange libs', () => { before(async () => { const accounts = await web3Wrapper.getAvailableAddressesAsync(); const makerAddress = accounts[0]; - libs = await TestLibsContract.deployFrom0xArtifactAsync(artifacts.TestLibs, provider, txDefaults); + libs = await TestLibsContract.deployFrom0xArtifactAsync(artifacts.TestLibs, provider, txDefaults, artifacts); const defaultOrderParams = { ...constants.STATIC_ORDER_PARAMS, diff --git a/contracts/exchange/test/core.ts b/contracts/exchange/test/core.ts index c617db9e39..f34af68f7b 100644 --- a/contracts/exchange/test/core.ts +++ b/contracts/exchange/test/core.ts @@ -119,11 +119,13 @@ describe('Exchange core', () => { proxyArtifacts.MultiAssetProxy, provider, txDefaults, + dependencyArtifacts, ); staticCallProxy = await StaticCallProxyContract.deployFrom0xArtifactAsync( proxyArtifacts.StaticCallProxy, provider, txDefaults, + dependencyArtifacts, ); const numDummyErc20ToDeploy = 3; [erc20TokenA, erc20TokenB, zrxToken] = await erc20Wrapper.deployDummyTokensAsync( @@ -354,6 +356,7 @@ describe('Exchange core', () => { erc20Artifacts.DummyNoReturnERC20Token, provider, txDefaults, + dependencyArtifacts, constants.DUMMY_TOKEN_NAME, constants.DUMMY_TOKEN_SYMBOL, constants.DUMMY_TOKEN_DECIMALS, @@ -384,7 +387,7 @@ describe('Exchange core', () => { const initialTakerZrxBalance = await zrxToken.balanceOf.callAsync(takerAddress); const initialFeeRecipientZrxBalance = await zrxToken.balanceOf.callAsync(feeRecipientAddress); - const txReceipt = await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress); + await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress); const finalMakerBalanceA = await noReturnErc20Token.balanceOf.callAsync(makerAddress); const finalMakerBalanceB = await erc20TokenB.balanceOf.callAsync(makerAddress); @@ -1479,6 +1482,7 @@ describe('Exchange core', () => { proxyArtifacts.TestStaticCallTarget, provider, txDefaults, + dependencyArtifacts, ); }); it('should revert if the staticcall is unsuccessful', async () => { diff --git a/contracts/exchange/test/dispatcher.ts b/contracts/exchange/test/dispatcher.ts index 08b1aa55a3..18192b7e8c 100644 --- a/contracts/exchange/test/dispatcher.ts +++ b/contracts/exchange/test/dispatcher.ts @@ -137,6 +137,7 @@ describe('AssetProxyDispatcher', () => { proxyArtifacts.ERC20Proxy, provider, txDefaults, + dependencyArtifacts, ); // Register new ERC20 Transfer Proxy contract return expectTransactionFailedAsync( diff --git a/contracts/exchange/test/utils/dependency_artifacts.ts b/contracts/exchange/test/utils/dependency_artifacts.ts index 047e7c8eff..3e0eb253da 100644 --- a/contracts/exchange/test/utils/dependency_artifacts.ts +++ b/contracts/exchange/test/utils/dependency_artifacts.ts @@ -6,4 +6,4 @@ export const dependencyArtifacts = { ...erc20Artifacts, ...erc721Artifacts, ...erc1155Artifacts, -}; \ No newline at end of file +}; diff --git a/contracts/exchange/test/utils/exchange_wrapper.ts b/contracts/exchange/test/utils/exchange_wrapper.ts index f9bd120320..97005606b5 100644 --- a/contracts/exchange/test/utils/exchange_wrapper.ts +++ b/contracts/exchange/test/utils/exchange_wrapper.ts @@ -1,25 +1,17 @@ -import { artifacts as erc1155Artifacts } from '@0x/contracts-erc1155'; -import { artifacts as erc20Artifacts } from '@0x/contracts-erc20'; -import { artifacts as erc721Artifacts } from '@0x/contracts-erc721'; -import { - FillResults, - formatters, - OrderInfo, - orderUtils, - Web3ProviderEngine, -} from '@0x/contracts-test-utils'; +import { FillResults, formatters, OrderInfo, orderUtils, Web3ProviderEngine } from '@0x/contracts-test-utils'; import { SignedOrder, SignedZeroExTransaction } from '@0x/types'; import { AbiEncoder, BigNumber } from '@0x/utils'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { MethodAbi, TransactionReceiptWithDecodedLogs, ZeroExProvider } from 'ethereum-types'; import * as _ from 'lodash'; -import { artifacts, ExchangeContract } from '../../src'; +import { ExchangeContract } from '../../src'; import { AbiDecodedFillOrderData } from './types'; export class ExchangeWrapper { private readonly _exchange: ExchangeContract; + // tslint:disable no-unused-variable private readonly _web3Wrapper: Web3Wrapper; constructor(exchangeContract: ExchangeContract, provider: Web3ProviderEngine | ZeroExProvider) { this._exchange = exchangeContract; @@ -186,7 +178,9 @@ export class ExchangeWrapper { assetProxyAddress: string, from: string, ): Promise { - const txReceipt = await this._exchange.registerAssetProxy.awaitTransactionSuccessAsync(assetProxyAddress, { from }); + const txReceipt = await this._exchange.registerAssetProxy.awaitTransactionSuccessAsync(assetProxyAddress, { + from, + }); return txReceipt; } public async executeTransactionAsync( diff --git a/contracts/exchange/test/utils/fill_order_combinatorial_utils.ts b/contracts/exchange/test/utils/fill_order_combinatorial_utils.ts index a42511ad3a..85b411a179 100644 --- a/contracts/exchange/test/utils/fill_order_combinatorial_utils.ts +++ b/contracts/exchange/test/utils/fill_order_combinatorial_utils.ts @@ -137,6 +137,7 @@ export async function fillOrderCombinatorialUtilsFactoryAsync( libsArtifacts.TestLibs, provider, txDefaults, + dependencyArtifacts, ); const fillOrderCombinatorialUtils = new FillOrderCombinatorialUtils( diff --git a/contracts/extensions/test/balance_threshold_filter.ts b/contracts/extensions/test/balance_threshold_filter.ts index 530eefd51b..f364a6d2d0 100644 --- a/contracts/extensions/test/balance_threshold_filter.ts +++ b/contracts/extensions/test/balance_threshold_filter.ts @@ -130,6 +130,7 @@ describe(ContractName.BalanceThresholdFilter, () => { artifacts.Exchange, provider, txDefaults, + artifacts, zrxAssetData, ); exchangeWrapper = new ExchangeWrapper(exchangeInstance, provider); @@ -148,6 +149,7 @@ describe(ContractName.BalanceThresholdFilter, () => { artifacts.BalanceThresholdFilter, provider, txDefaults, + artifacts, exchangeInstance.address, erc721BalanceThresholdAsset.address, erc721alanceThreshold, @@ -157,6 +159,7 @@ describe(ContractName.BalanceThresholdFilter, () => { artifacts.BalanceThresholdFilter, provider, txDefaults, + artifacts, exchangeInstance.address, erc20BalanceThresholdAsset.address, erc20BalanceThreshold, diff --git a/contracts/extensions/test/dutch_auction.ts b/contracts/extensions/test/dutch_auction.ts index 639f61999d..01c8e4a25a 100644 --- a/contracts/extensions/test/dutch_auction.ts +++ b/contracts/extensions/test/dutch_auction.ts @@ -82,7 +82,7 @@ describe(ContractName.DutchAuction, () => { const erc721Balances = await erc721Wrapper.getBalancesAsync(); erc721MakerAssetIds = erc721Balances[makerAddress][erc721Token.address]; - wethContract = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.WETH9, provider, txDefaults); + wethContract = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.WETH9, provider, txDefaults, artifacts); erc20Wrapper.addDummyTokenContract(wethContract as any); const zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address); @@ -90,6 +90,7 @@ describe(ContractName.DutchAuction, () => { artifacts.Exchange, provider, txDefaults, + artifacts, zrxAssetData, ); const exchangeWrapper = new ExchangeWrapper(exchangeInstance, provider); @@ -107,6 +108,7 @@ describe(ContractName.DutchAuction, () => { artifacts.DutchAuction, provider, txDefaults, + artifacts, exchangeInstance.address, ); dutchAuctionContract = new DutchAuctionContract(dutchAuctionInstance.address, provider); diff --git a/contracts/extensions/test/order_matcher.ts b/contracts/extensions/test/order_matcher.ts index 99ec0d06d9..6c6c368c07 100644 --- a/contracts/extensions/test/order_matcher.ts +++ b/contracts/extensions/test/order_matcher.ts @@ -103,12 +103,14 @@ describe('OrderMatcher', () => { proxyArtifacts.ERC721Proxy, provider, txDefaults, + artifacts, ); // Depoy exchange exchange = await ExchangeContract.deployFrom0xArtifactAsync( artifacts.Exchange, provider, txDefaults, + artifacts, assetDataUtils.encodeERC20AssetData(zrxToken.address), ); exchangeWrapper = new ExchangeWrapper(exchange, provider); @@ -126,6 +128,7 @@ describe('OrderMatcher', () => { artifacts.OrderMatcher, provider, txDefaults, + artifacts, exchange.address, ); // Set default addresses @@ -198,6 +201,7 @@ describe('OrderMatcher', () => { artifacts.Exchange, provider, txDefaults, + artifacts, constants.NULL_BYTES, ); return expectContractCreationFailedAsync( @@ -205,6 +209,7 @@ describe('OrderMatcher', () => { artifacts.OrderMatcher, provider, txDefaults, + artifacts, exchangeInstance.address, ) as any) as sendTransactionResult, RevertReason.UnregisteredAssetProxy, @@ -727,6 +732,7 @@ describe('OrderMatcher', () => { erc721Artifacts.DummyERC721Token, provider, txDefaults, + artifacts, constants.DUMMY_TOKEN_NAME, constants.DUMMY_TOKEN_SYMBOL, ); @@ -772,6 +778,7 @@ describe('OrderMatcher', () => { erc721Artifacts.DummyERC721Token, provider, txDefaults, + artifacts, constants.DUMMY_TOKEN_NAME, constants.DUMMY_TOKEN_SYMBOL, ); @@ -789,6 +796,7 @@ describe('OrderMatcher', () => { erc721Artifacts.DummyERC721Token, provider, txDefaults, + artifacts, constants.DUMMY_TOKEN_NAME, constants.DUMMY_TOKEN_SYMBOL, ); diff --git a/contracts/multisig/test/asset_proxy_owner.ts b/contracts/multisig/test/asset_proxy_owner.ts index 62081554be..ff9f6b5c50 100644 --- a/contracts/multisig/test/asset_proxy_owner.ts +++ b/contracts/multisig/test/asset_proxy_owner.ts @@ -61,17 +61,20 @@ describe('AssetProxyOwner', () => { proxyArtifacts.MixinAuthorizable, provider, txDefaults, + artifacts, ); erc721Proxy = await MixinAuthorizableContract.deployFrom0xArtifactAsync( proxyArtifacts.MixinAuthorizable, provider, txDefaults, + artifacts, ); const defaultAssetProxyContractAddresses: string[] = []; testAssetProxyOwner = await TestAssetProxyOwnerContract.deployFrom0xArtifactAsync( artifacts.TestAssetProxyOwner, provider, txDefaults, + artifacts, owners, defaultAssetProxyContractAddresses, REQUIRED_APPROVALS, @@ -105,6 +108,7 @@ describe('AssetProxyOwner', () => { artifacts.AssetProxyOwner, provider, txDefaults, + artifacts, owners, assetProxyContractAddresses, REQUIRED_APPROVALS, @@ -122,6 +126,7 @@ describe('AssetProxyOwner', () => { artifacts.AssetProxyOwner, provider, txDefaults, + artifacts, owners, assetProxyContractAddresses, REQUIRED_APPROVALS, diff --git a/contracts/multisig/test/multi_sig_with_time_lock.ts b/contracts/multisig/test/multi_sig_with_time_lock.ts index 9596271514..6208f23a53 100644 --- a/contracts/multisig/test/multi_sig_with_time_lock.ts +++ b/contracts/multisig/test/multi_sig_with_time_lock.ts @@ -66,6 +66,7 @@ describe('MultiSigWalletWithTimeLock', () => { artifacts.MultiSigWalletWithTimeLock, provider, txDefaults, + artifacts, owners, REQUIRED_APPROVALS, secondsTimeLocked, @@ -81,6 +82,7 @@ describe('MultiSigWalletWithTimeLock', () => { artifacts.MultiSigWalletWithTimeLock, provider, txDefaults, + artifacts, owners, REQUIRED_APPROVALS, secondsTimeLocked, @@ -135,6 +137,7 @@ describe('MultiSigWalletWithTimeLock', () => { artifacts.MultiSigWalletWithTimeLock, provider, txDefaults, + artifacts, owners, REQUIRED_APPROVALS, secondsTimeLocked, @@ -198,6 +201,7 @@ describe('MultiSigWalletWithTimeLock', () => { artifacts.TestRejectEther, provider, txDefaults, + artifacts, ); const data = constants.NULL_BYTES; const value = new BigNumber(10); @@ -234,6 +238,7 @@ describe('MultiSigWalletWithTimeLock', () => { artifacts.MultiSigWalletWithTimeLock, provider, txDefaults, + artifacts, owners, REQUIRED_APPROVALS, secondsTimeLocked, @@ -308,6 +313,7 @@ describe('MultiSigWalletWithTimeLock', () => { artifacts.MultiSigWalletWithTimeLock, provider, txDefaults, + artifacts, owners, REQUIRED_APPROVALS, SECONDS_TIME_LOCKED, diff --git a/contracts/utils/test/lib_address_array.ts b/contracts/utils/test/lib_address_array.ts index bb0d441a5c..4b96262a63 100644 --- a/contracts/utils/test/lib_address_array.ts +++ b/contracts/utils/test/lib_address_array.ts @@ -28,6 +28,7 @@ describe('LibAddressArray', () => { artifacts.TestLibAddressArray, provider, txDefaults, + artifacts, ); }); after(async () => { diff --git a/contracts/utils/test/lib_bytes.ts b/contracts/utils/test/lib_bytes.ts index cedcb9d80a..69aa650803 100644 --- a/contracts/utils/test/lib_bytes.ts +++ b/contracts/utils/test/lib_bytes.ts @@ -68,7 +68,12 @@ describe('LibBytes', () => { testAddress = accounts[1]; testAddressB = accounts[2]; // Deploy LibBytes - libBytes = await TestLibBytesContract.deployFrom0xArtifactAsync(artifacts.TestLibBytes, provider, txDefaults); + libBytes = await TestLibBytesContract.deployFrom0xArtifactAsync( + artifacts.TestLibBytes, + provider, + txDefaults, + artifacts, + ); // Verify lengths of test data const byteArrayShorterThan32BytesLength = ethUtil.toBuffer(byteArrayShorterThan32Bytes).byteLength; expect(byteArrayShorterThan32BytesLength).to.be.lessThan(32); diff --git a/contracts/utils/test/libs.ts b/contracts/utils/test/libs.ts index 77dc6e2ba5..6d50ca8fac 100644 --- a/contracts/utils/test/libs.ts +++ b/contracts/utils/test/libs.ts @@ -24,6 +24,7 @@ describe('Libs', () => { artifacts.TestConstants, provider, txDefaults, + artifacts, ); const isValid = await testConstants.assertValidZrxAssetData.callAsync(); expect(isValid).to.be.equal(true); 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 45f96008b2..98f51c02d7 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 @@ -1,14 +1,11 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { - BaseContract, +import { BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager, - PromiseWithTransactionHash, -} from '@0x/base-contract'; + SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -29,6 +26,7 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; +import * as _ from 'lodash'; // tslint:enable:no-unused-variable export type AssetProxyOwnerEventArgs = @@ -113,6 +111,7 @@ export interface AssetProxyOwnerRequirementChangeEventArgs extends DecodedLogArg required: BigNumber; } + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name @@ -122,7 +121,8 @@ export class AssetProxyOwnerContract extends BaseContract { index_0: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -132,8 +132,9 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('owners(uint256)', [index_0]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('owners(uint256)', [index_0 + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -142,45 +143,54 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owners(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: BigNumber): string { + getABIEncodedTransactionData( + index_0: BigNumber, + ): string { assert.isBigNumber('index_0', index_0); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('owners(uint256)', [index_0]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('owners(uint256)', [index_0 + ]); return abiEncodedTransactionData; }, }; public removeOwner = { - async sendTransactionAsync(owner: string, txData?: Partial | undefined): Promise { - assert.isString('owner', owner); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeOwner.estimateGasAsync.bind(self, owner.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + owner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('owner', owner); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeOwner.estimateGasAsync.bind( + self, + owner.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( owner: string, @@ -188,41 +198,51 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('owner', owner); - const self = (this as any) as AssetProxyOwnerContract; - const txHashPromise = self.removeOwner.sendTransactionAsync(owner.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('owner', owner); + const self = this as any as AssetProxyOwnerContract; + const txHashPromise = self.removeOwner.sendTransactionAsync(owner.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(owner: string, txData?: Partial | undefined): Promise { - assert.isString('owner', owner); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + owner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('owner', owner); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(owner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + owner: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('owner', owner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -232,8 +252,9 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner.toLowerCase()]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -242,47 +263,54 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeOwner(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(owner: string): string { + getABIEncodedTransactionData( + owner: string, + ): string { assert.isString('owner', owner); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeOwner(address)', [ - owner.toLowerCase(), - ]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeOwner(address)', [owner.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public revokeConfirmation = { - async sendTransactionAsync(transactionId: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.revokeConfirmation.estimateGasAsync.bind(self, transactionId), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + transactionId: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('transactionId', transactionId); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.revokeConfirmation.estimateGasAsync.bind( + self, + transactionId + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( transactionId: BigNumber, @@ -290,45 +318,51 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const txHashPromise = self.revokeConfirmation.sendTransactionAsync(transactionId, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('transactionId', transactionId); + const self = this as any as AssetProxyOwnerContract; + const txHashPromise = self.revokeConfirmation.sendTransactionAsync(transactionId + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(transactionId: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + transactionId: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('transactionId', transactionId); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( transactionId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('transactionId', transactionId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -338,8 +372,9 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -348,24 +383,24 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('revokeConfirmation(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(transactionId: BigNumber): string { + getABIEncodedTransactionData( + transactionId: BigNumber, + ): string { assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('revokeConfirmation(uint256)', [ - transactionId, - ]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId + ]); return abiEncodedTransactionData; }, }; @@ -374,7 +409,8 @@ export class AssetProxyOwnerContract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -384,8 +420,9 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('isOwner(address)', [index_0.toLowerCase()]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('isOwner(address)', [index_0.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -394,22 +431,24 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isOwner(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: string): string { + getABIEncodedTransactionData( + index_0: string, + ): string { assert.isString('index_0', index_0); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('isOwner(address)', [index_0.toLowerCase()]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isOwner(address)', [index_0.toLowerCase() + ]); return abiEncodedTransactionData; }, }; @@ -419,7 +458,8 @@ export class AssetProxyOwnerContract extends BaseContract { index_1: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('index_0', index_0); assert.isString('index_1', index_1); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -430,11 +470,10 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('confirmations(uint256,address)', [ - index_0, - index_1.toLowerCase(), - ]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('confirmations(uint256,address)', [index_0, + index_1.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -443,51 +482,57 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('confirmations(uint256,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: BigNumber, index_1: string): string { + getABIEncodedTransactionData( + index_0: BigNumber, + index_1: string, + ): string { assert.isBigNumber('index_0', index_0); assert.isString('index_1', index_1); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('confirmations(uint256,address)', [ - index_0, - index_1.toLowerCase(), - ]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('confirmations(uint256,address)', [index_0, + index_1.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public executeRemoveAuthorizedAddressAtIndex = { - async sendTransactionAsync(transactionId: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [ - transactionId, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.executeRemoveAuthorizedAddressAtIndex.estimateGasAsync.bind(self, transactionId), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + transactionId: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('transactionId', transactionId); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [transactionId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.executeRemoveAuthorizedAddressAtIndex.estimateGasAsync.bind( + self, + transactionId + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( transactionId: BigNumber, @@ -495,50 +540,51 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const txHashPromise = self.executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync( - transactionId, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('transactionId', transactionId); + const self = this as any as AssetProxyOwnerContract; + const txHashPromise = self.executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(transactionId + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(transactionId: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [ - transactionId, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + transactionId: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('transactionId', transactionId); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [transactionId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( transactionId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('transactionId', transactionId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -548,10 +594,9 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [ - transactionId, - ]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [transactionId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -560,30 +605,33 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('executeRemoveAuthorizedAddressAtIndex(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(transactionId: BigNumber): string { + getABIEncodedTransactionData( + transactionId: BigNumber, + ): string { assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'executeRemoveAuthorizedAddressAtIndex(uint256)', - [transactionId], - ); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [transactionId + ]); return abiEncodedTransactionData; }, }; public secondsTimeLocked = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -592,7 +640,7 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; + const self = this as any as AssetProxyOwnerContract; const encodedData = self._strictEncodeArguments('secondsTimeLocked()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -602,20 +650,20 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('secondsTimeLocked()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as AssetProxyOwnerContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as AssetProxyOwnerContract; const abiEncodedTransactionData = self._strictEncodeArguments('secondsTimeLocked()', []); return abiEncodedTransactionData; }, @@ -626,7 +674,8 @@ export class AssetProxyOwnerContract extends BaseContract { executed: boolean, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBoolean('pending', pending); assert.isBoolean('executed', executed); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -637,8 +686,10 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('getTransactionCount(bool,bool)', [pending, executed]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('getTransactionCount(bool,bool)', [pending, + executed + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -647,26 +698,27 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getTransactionCount(bool,bool)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(pending: boolean, executed: boolean): string { + getABIEncodedTransactionData( + pending: boolean, + executed: boolean, + ): string { assert.isBoolean('pending', pending); assert.isBoolean('executed', executed); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getTransactionCount(bool,bool)', [ - pending, - executed, - ]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getTransactionCount(bool,bool)', [pending, + executed + ]); return abiEncodedTransactionData; }, }; @@ -674,30 +726,33 @@ export class AssetProxyOwnerContract extends BaseContract { async sendTransactionAsync( assetProxyContract: string, isRegistered: boolean, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('assetProxyContract', assetProxyContract); - assert.isBoolean('isRegistered', isRegistered); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [ + assert.isString('assetProxyContract', assetProxyContract); + assert.isBoolean('isRegistered', isRegistered); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [assetProxyContract.toLowerCase(), + isRegistered + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.registerAssetProxy.estimateGasAsync.bind( + self, assetProxyContract.toLowerCase(), - isRegistered, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.registerAssetProxy.estimateGasAsync.bind(self, assetProxyContract.toLowerCase(), isRegistered), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + isRegistered + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( assetProxyContract: string, @@ -706,59 +761,57 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('assetProxyContract', assetProxyContract); - assert.isBoolean('isRegistered', isRegistered); - const self = (this as any) as AssetProxyOwnerContract; - const txHashPromise = self.registerAssetProxy.sendTransactionAsync( - assetProxyContract.toLowerCase(), - isRegistered, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('assetProxyContract', assetProxyContract); + assert.isBoolean('isRegistered', isRegistered); + const self = this as any as AssetProxyOwnerContract; + const txHashPromise = self.registerAssetProxy.sendTransactionAsync(assetProxyContract.toLowerCase(), + isRegistered + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( assetProxyContract: string, isRegistered: boolean, txData?: Partial | undefined, ): Promise { - assert.isString('assetProxyContract', assetProxyContract); - assert.isBoolean('isRegistered', isRegistered); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [ - assetProxyContract.toLowerCase(), - isRegistered, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('assetProxyContract', assetProxyContract); + assert.isBoolean('isRegistered', isRegistered); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [assetProxyContract.toLowerCase(), + isRegistered + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( assetProxyContract: string, isRegistered: boolean, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('assetProxyContract', assetProxyContract); assert.isBoolean('isRegistered', isRegistered); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -769,11 +822,10 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [ - assetProxyContract.toLowerCase(), - isRegistered, - ]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [assetProxyContract.toLowerCase(), + isRegistered + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -782,49 +834,57 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address,bool)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(assetProxyContract: string, isRegistered: boolean): string { + getABIEncodedTransactionData( + assetProxyContract: string, + isRegistered: boolean, + ): string { assert.isString('assetProxyContract', assetProxyContract); assert.isBoolean('isRegistered', isRegistered); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [ - assetProxyContract.toLowerCase(), - isRegistered, - ]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [assetProxyContract.toLowerCase(), + isRegistered + ]); return abiEncodedTransactionData; }, }; public addOwner = { - async sendTransactionAsync(owner: string, txData?: Partial | undefined): Promise { - assert.isString('owner', owner); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.addOwner.estimateGasAsync.bind(self, owner.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + owner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('owner', owner); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.addOwner.estimateGasAsync.bind( + self, + owner.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( owner: string, @@ -832,41 +892,51 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('owner', owner); - const self = (this as any) as AssetProxyOwnerContract; - const txHashPromise = self.addOwner.sendTransactionAsync(owner.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('owner', owner); + const self = this as any as AssetProxyOwnerContract; + const txHashPromise = self.addOwner.sendTransactionAsync(owner.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(owner: string, txData?: Partial | undefined): Promise { - assert.isString('owner', owner); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + owner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('owner', owner); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(owner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + owner: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('owner', owner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -876,8 +946,9 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase()]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -886,22 +957,24 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('addOwner(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(owner: string): string { + getABIEncodedTransactionData( + owner: string, + ): string { assert.isString('owner', owner); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase()]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase() + ]); return abiEncodedTransactionData; }, }; @@ -910,7 +983,8 @@ export class AssetProxyOwnerContract extends BaseContract { transactionId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('transactionId', transactionId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -920,8 +994,9 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('isConfirmed(uint256)', [transactionId]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('isConfirmed(uint256)', [transactionId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -930,48 +1005,54 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isConfirmed(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(transactionId: BigNumber): string { + getABIEncodedTransactionData( + transactionId: BigNumber, + ): string { assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('isConfirmed(uint256)', [transactionId]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isConfirmed(uint256)', [transactionId + ]); return abiEncodedTransactionData; }, }; public changeTimeLock = { async sendTransactionAsync( _secondsTimeLocked: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.changeTimeLock.estimateGasAsync.bind(self, _secondsTimeLocked), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.changeTimeLock.estimateGasAsync.bind( + self, + _secondsTimeLocked + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _secondsTimeLocked: BigNumber, @@ -979,45 +1060,51 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); - const self = (this as any) as AssetProxyOwnerContract; - const txHashPromise = self.changeTimeLock.sendTransactionAsync(_secondsTimeLocked, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); + const self = this as any as AssetProxyOwnerContract; + const txHashPromise = self.changeTimeLock.sendTransactionAsync(_secondsTimeLocked + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(_secondsTimeLocked: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + _secondsTimeLocked: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _secondsTimeLocked: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1027,8 +1114,9 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1037,24 +1125,24 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('changeTimeLock(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_secondsTimeLocked: BigNumber): string { + getABIEncodedTransactionData( + _secondsTimeLocked: BigNumber, + ): string { assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('changeTimeLock(uint256)', [ - _secondsTimeLocked, - ]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked + ]); return abiEncodedTransactionData; }, }; @@ -1063,7 +1151,8 @@ export class AssetProxyOwnerContract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1073,8 +1162,9 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('isAssetProxyRegistered(address)', [index_0.toLowerCase()]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('isAssetProxyRegistered(address)', [index_0.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1083,24 +1173,24 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isAssetProxyRegistered(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: string): string { + getABIEncodedTransactionData( + index_0: string, + ): string { assert.isString('index_0', index_0); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('isAssetProxyRegistered(address)', [ - index_0.toLowerCase(), - ]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isAssetProxyRegistered(address)', [index_0.toLowerCase() + ]); return abiEncodedTransactionData; }, }; @@ -1109,7 +1199,8 @@ export class AssetProxyOwnerContract extends BaseContract { transactionId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('transactionId', transactionId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1119,8 +1210,9 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('getConfirmationCount(uint256)', [transactionId]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('getConfirmationCount(uint256)', [transactionId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1129,24 +1221,24 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getConfirmationCount(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(transactionId: BigNumber): string { + getABIEncodedTransactionData( + transactionId: BigNumber, + ): string { assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getConfirmationCount(uint256)', [ - transactionId, - ]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getConfirmationCount(uint256)', [transactionId + ]); return abiEncodedTransactionData; }, }; @@ -1155,7 +1247,8 @@ export class AssetProxyOwnerContract extends BaseContract { index_0: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<[string, BigNumber, string, boolean]> { + ): Promise<[string, BigNumber, string, boolean] + > { assert.isBigNumber('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1165,8 +1258,9 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('transactions(uint256)', [index_0]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('transactions(uint256)', [index_0 + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1175,27 +1269,33 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transactions(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<[string, BigNumber, string, boolean]>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<[string, BigNumber, string, boolean] + >(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: BigNumber): string { + getABIEncodedTransactionData( + index_0: BigNumber, + ): string { assert.isBigNumber('index_0', index_0); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transactions(uint256)', [index_0]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transactions(uint256)', [index_0 + ]); return abiEncodedTransactionData; }, }; public getOwners = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -1204,7 +1304,7 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; + const self = this as any as AssetProxyOwnerContract; const encodedData = self._strictEncodeArguments('getOwners()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1214,20 +1314,20 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getOwners()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as AssetProxyOwnerContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as AssetProxyOwnerContract; const abiEncodedTransactionData = self._strictEncodeArguments('getOwners()', []); return abiEncodedTransactionData; }, @@ -1240,7 +1340,8 @@ export class AssetProxyOwnerContract extends BaseContract { executed: boolean, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('from', from); assert.isBigNumber('to', to); assert.isBoolean('pending', pending); @@ -1253,13 +1354,12 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('getTransactionIds(uint256,uint256,bool,bool)', [ - from, - to, - pending, - executed, - ]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('getTransactionIds(uint256,uint256,bool,bool)', [from, + to, + pending, + executed + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1268,28 +1368,33 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getTransactionIds(uint256,uint256,bool,bool)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(from: BigNumber, to: BigNumber, pending: boolean, executed: boolean): string { + getABIEncodedTransactionData( + from: BigNumber, + to: BigNumber, + pending: boolean, + executed: boolean, + ): string { assert.isBigNumber('from', from); assert.isBigNumber('to', to); assert.isBoolean('pending', pending); assert.isBoolean('executed', executed); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'getTransactionIds(uint256,uint256,bool,bool)', - [from, to, pending, executed], - ); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getTransactionIds(uint256,uint256,bool,bool)', [from, + to, + pending, + executed + ]); return abiEncodedTransactionData; }, }; @@ -1298,7 +1403,8 @@ export class AssetProxyOwnerContract extends BaseContract { transactionId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('transactionId', transactionId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1308,8 +1414,9 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('getConfirmations(uint256)', [transactionId]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('getConfirmations(uint256)', [transactionId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1318,27 +1425,33 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getConfirmations(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(transactionId: BigNumber): string { + getABIEncodedTransactionData( + transactionId: BigNumber, + ): string { assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getConfirmations(uint256)', [transactionId]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getConfirmations(uint256)', [transactionId + ]); return abiEncodedTransactionData; }, }; public transactionCount = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -1347,7 +1460,7 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; + const self = this as any as AssetProxyOwnerContract; const encodedData = self._strictEncodeArguments('transactionCount()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1357,44 +1470,51 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transactionCount()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as AssetProxyOwnerContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as AssetProxyOwnerContract; const abiEncodedTransactionData = self._strictEncodeArguments('transactionCount()', []); return abiEncodedTransactionData; }, }; public changeRequirement = { - async sendTransactionAsync(_required: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('_required', _required); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('changeRequirement(uint256)', [_required]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.changeRequirement.estimateGasAsync.bind(self, _required), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + _required: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('_required', _required); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('changeRequirement(uint256)', [_required + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.changeRequirement.estimateGasAsync.bind( + self, + _required + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _required: BigNumber, @@ -1402,45 +1522,51 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('_required', _required); - const self = (this as any) as AssetProxyOwnerContract; - const txHashPromise = self.changeRequirement.sendTransactionAsync(_required, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('_required', _required); + const self = this as any as AssetProxyOwnerContract; + const txHashPromise = self.changeRequirement.sendTransactionAsync(_required + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(_required: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('_required', _required); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('changeRequirement(uint256)', [_required]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + _required: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('_required', _required); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('changeRequirement(uint256)', [_required + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _required: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('_required', _required); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1450,8 +1576,9 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('changeRequirement(uint256)', [_required]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('changeRequirement(uint256)', [_required + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1460,45 +1587,54 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('changeRequirement(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_required: BigNumber): string { + getABIEncodedTransactionData( + _required: BigNumber, + ): string { assert.isBigNumber('_required', _required); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('changeRequirement(uint256)', [_required]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('changeRequirement(uint256)', [_required + ]); return abiEncodedTransactionData; }, }; public confirmTransaction = { - async sendTransactionAsync(transactionId: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.confirmTransaction.estimateGasAsync.bind(self, transactionId), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + transactionId: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('transactionId', transactionId); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.confirmTransaction.estimateGasAsync.bind( + self, + transactionId + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( transactionId: BigNumber, @@ -1506,45 +1642,51 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const txHashPromise = self.confirmTransaction.sendTransactionAsync(transactionId, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('transactionId', transactionId); + const self = this as any as AssetProxyOwnerContract; + const txHashPromise = self.confirmTransaction.sendTransactionAsync(transactionId + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(transactionId: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + transactionId: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('transactionId', transactionId); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( transactionId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('transactionId', transactionId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1554,8 +1696,9 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1564,24 +1707,24 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('confirmTransaction(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(transactionId: BigNumber): string { + getABIEncodedTransactionData( + transactionId: BigNumber, + ): string { assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('confirmTransaction(uint256)', [ - transactionId, - ]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId + ]); return abiEncodedTransactionData; }, }; @@ -1590,32 +1733,36 @@ export class AssetProxyOwnerContract extends BaseContract { destination: string, value: BigNumber, data: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('destination', destination); - assert.isBigNumber('value', value); - assert.isString('data', data); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [ - destination.toLowerCase(), - value, - data, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.submitTransaction.estimateGasAsync.bind(self, destination.toLowerCase(), value, data), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isString('destination', destination); + assert.isBigNumber('value', value); + assert.isString('data', data); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [destination.toLowerCase(), + value, + data + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.submitTransaction.estimateGasAsync.bind( + self, + destination.toLowerCase(), + value, + data + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( destination: string, @@ -1625,27 +1772,25 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('destination', destination); - assert.isBigNumber('value', value); - assert.isString('data', data); - const self = (this as any) as AssetProxyOwnerContract; - const txHashPromise = self.submitTransaction.sendTransactionAsync( - destination.toLowerCase(), - value, - data, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('destination', destination); + assert.isBigNumber('value', value); + assert.isString('data', data); + const self = this as any as AssetProxyOwnerContract; + const txHashPromise = self.submitTransaction.sendTransactionAsync(destination.toLowerCase(), + value, + data + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( destination: string, @@ -1653,29 +1798,28 @@ export class AssetProxyOwnerContract extends BaseContract { data: string, txData?: Partial | undefined, ): Promise { - assert.isString('destination', destination); - assert.isBigNumber('value', value); - assert.isString('data', data); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [ - destination.toLowerCase(), - value, - data, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('destination', destination); + assert.isBigNumber('value', value); + assert.isString('data', data); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [destination.toLowerCase(), + value, + data + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( destination: string, @@ -1683,7 +1827,8 @@ export class AssetProxyOwnerContract extends BaseContract { data: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('destination', destination); assert.isBigNumber('value', value); assert.isString('data', data); @@ -1695,12 +1840,11 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [ - destination.toLowerCase(), - value, - data, - ]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [destination.toLowerCase(), + value, + data + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1709,28 +1853,30 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('submitTransaction(address,uint256,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(destination: string, value: BigNumber, data: string): string { + getABIEncodedTransactionData( + destination: string, + value: BigNumber, + data: string, + ): string { assert.isString('destination', destination); assert.isBigNumber('value', value); assert.isString('data', data); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [ - destination.toLowerCase(), - value, - data, - ]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [destination.toLowerCase(), + value, + data + ]); return abiEncodedTransactionData; }, }; @@ -1739,7 +1885,8 @@ export class AssetProxyOwnerContract extends BaseContract { index_0: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1749,8 +1896,9 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('confirmationTimes(uint256)', [index_0]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('confirmationTimes(uint256)', [index_0 + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1759,27 +1907,33 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('confirmationTimes(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: BigNumber): string { + getABIEncodedTransactionData( + index_0: BigNumber, + ): string { assert.isBigNumber('index_0', index_0); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('confirmationTimes(uint256)', [index_0]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('confirmationTimes(uint256)', [index_0 + ]); return abiEncodedTransactionData; }, }; public MAX_OWNER_COUNT = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -1788,7 +1942,7 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; + const self = this as any as AssetProxyOwnerContract; const encodedData = self._strictEncodeArguments('MAX_OWNER_COUNT()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1798,26 +1952,30 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('MAX_OWNER_COUNT()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as AssetProxyOwnerContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as AssetProxyOwnerContract; const abiEncodedTransactionData = self._strictEncodeArguments('MAX_OWNER_COUNT()', []); return abiEncodedTransactionData; }, }; public required = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -1826,7 +1984,7 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; + const self = this as any as AssetProxyOwnerContract; const encodedData = self._strictEncodeArguments('required()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1836,20 +1994,20 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('required()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as AssetProxyOwnerContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as AssetProxyOwnerContract; const abiEncodedTransactionData = self._strictEncodeArguments('required()', []); return abiEncodedTransactionData; }, @@ -1858,30 +2016,33 @@ export class AssetProxyOwnerContract extends BaseContract { async sendTransactionAsync( owner: string, newOwner: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('owner', owner); - assert.isString('newOwner', newOwner); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [ + assert.isString('owner', owner); + assert.isString('newOwner', newOwner); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [owner.toLowerCase(), + newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.replaceOwner.estimateGasAsync.bind( + self, owner.toLowerCase(), - newOwner.toLowerCase(), - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.replaceOwner.estimateGasAsync.bind(self, owner.toLowerCase(), newOwner.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + newOwner.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( owner: string, @@ -1890,55 +2051,57 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('owner', owner); - assert.isString('newOwner', newOwner); - const self = (this as any) as AssetProxyOwnerContract; - const txHashPromise = self.replaceOwner.sendTransactionAsync( - owner.toLowerCase(), - newOwner.toLowerCase(), - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('owner', owner); + assert.isString('newOwner', newOwner); + const self = this as any as AssetProxyOwnerContract; + const txHashPromise = self.replaceOwner.sendTransactionAsync(owner.toLowerCase(), + newOwner.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(owner: string, newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('owner', owner); - assert.isString('newOwner', newOwner); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [ - owner.toLowerCase(), - newOwner.toLowerCase(), - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + owner: string, + newOwner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('owner', owner); + assert.isString('newOwner', newOwner); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [owner.toLowerCase(), + newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( owner: string, newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('owner', owner); assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -1949,11 +2112,10 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [ - owner.toLowerCase(), - newOwner.toLowerCase(), - ]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [owner.toLowerCase(), + newOwner.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1962,49 +2124,57 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('replaceOwner(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(owner: string, newOwner: string): string { + getABIEncodedTransactionData( + owner: string, + newOwner: string, + ): string { assert.isString('owner', owner); assert.isString('newOwner', newOwner); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('replaceOwner(address,address)', [ - owner.toLowerCase(), - newOwner.toLowerCase(), - ]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('replaceOwner(address,address)', [owner.toLowerCase(), + newOwner.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public executeTransaction = { - async sendTransactionAsync(transactionId: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.executeTransaction.estimateGasAsync.bind(self, transactionId), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + transactionId: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('transactionId', transactionId); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.executeTransaction.estimateGasAsync.bind( + self, + transactionId + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( transactionId: BigNumber, @@ -2012,45 +2182,51 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const txHashPromise = self.executeTransaction.sendTransactionAsync(transactionId, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('transactionId', transactionId); + const self = this as any as AssetProxyOwnerContract; + const txHashPromise = self.executeTransaction.sendTransactionAsync(transactionId + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(transactionId: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + transactionId: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('transactionId', transactionId); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( transactionId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('transactionId', transactionId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -2060,8 +2236,9 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2070,36 +2247,37 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('executeTransaction(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(transactionId: BigNumber): string { + getABIEncodedTransactionData( + transactionId: BigNumber, + ): string { assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('executeTransaction(uint256)', [ - transactionId, - ]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId + ]); return abiEncodedTransactionData; }, }; - private readonly _subscriptionManager: SubscriptionManager; - public static async deployFrom0xArtifactAsync( +private readonly _subscriptionManager: SubscriptionManager; +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - _owners: string[], - _assetProxyContracts: string[], - _required: BigNumber, - _secondsTimeLocked: BigNumber, + artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + _owners: string[], + _assetProxyContracts: string[], + _required: BigNumber, + _secondsTimeLocked: BigNumber, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -2112,26 +2290,23 @@ export class AssetProxyOwnerContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - return AssetProxyOwnerContract.deployAsync( - bytecode, - abi, - provider, - txDefaults, - _owners, - _assetProxyContracts, - _required, - _secondsTimeLocked, - ); + const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); + return AssetProxyOwnerContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, _owners, +_assetProxyContracts, +_required, +_secondsTimeLocked +); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, - _owners: string[], - _assetProxyContracts: string[], - _required: BigNumber, - _secondsTimeLocked: BigNumber, + abiDependencies: { [contractName: string]: ContractAbi }, + _owners: string[], + _assetProxyContracts: string[], + _required: BigNumber, + _secondsTimeLocked: BigNumber, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -2141,17 +2316,29 @@ export class AssetProxyOwnerContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_owners, _assetProxyContracts, _required, _secondsTimeLocked] = BaseContract._formatABIDataItemList( + [_owners, +_assetProxyContracts, +_required, +_secondsTimeLocked +] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [_owners, _assetProxyContracts, _required, _secondsTimeLocked], + [_owners, +_assetProxyContracts, +_required, +_secondsTimeLocked +], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_owners, _assetProxyContracts, _required, _secondsTimeLocked]); + const txData = deployInfo.encode(bytecode, [_owners, +_assetProxyContracts, +_required, +_secondsTimeLocked +]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -2159,17 +2346,22 @@ export class AssetProxyOwnerContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`AssetProxyOwner successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new AssetProxyOwnerContract(txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = [_owners, _assetProxyContracts, _required, _secondsTimeLocked]; + const contractInstance = new AssetProxyOwnerContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); + contractInstance.constructorArgs = [_owners, +_assetProxyContracts, +_required, +_secondsTimeLocked +]; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -2188,7 +2380,7 @@ export class AssetProxyOwnerContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2197,12 +2389,13 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'removeOwner', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2211,12 +2404,13 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'revokeConfirmation', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2235,7 +2429,7 @@ export class AssetProxyOwnerContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2258,7 +2452,7 @@ export class AssetProxyOwnerContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2267,14 +2461,16 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'executeRemoveAuthorizedAddressAtIndex', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'secondsTimeLocked', outputs: [ { @@ -2286,7 +2482,7 @@ export class AssetProxyOwnerContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2309,7 +2505,7 @@ export class AssetProxyOwnerContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2322,12 +2518,13 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'registerAssetProxy', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2336,12 +2533,13 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'addOwner', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2360,7 +2558,7 @@ export class AssetProxyOwnerContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2369,12 +2567,13 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'changeTimeLock', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2393,7 +2592,7 @@ export class AssetProxyOwnerContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2412,7 +2611,7 @@ export class AssetProxyOwnerContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2443,9 +2642,10 @@ export class AssetProxyOwnerContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'getOwners', outputs: [ { @@ -2457,7 +2657,7 @@ export class AssetProxyOwnerContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2488,7 +2688,7 @@ export class AssetProxyOwnerContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2507,9 +2707,10 @@ export class AssetProxyOwnerContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'transactionCount', outputs: [ { @@ -2521,7 +2722,7 @@ export class AssetProxyOwnerContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2530,12 +2731,13 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'changeRequirement', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2544,12 +2746,13 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'confirmTransaction', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2576,7 +2779,7 @@ export class AssetProxyOwnerContract extends BaseContract { stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2595,9 +2798,10 @@ export class AssetProxyOwnerContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'MAX_OWNER_COUNT', outputs: [ { @@ -2609,9 +2813,10 @@ export class AssetProxyOwnerContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'required', outputs: [ { @@ -2623,7 +2828,7 @@ export class AssetProxyOwnerContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2636,12 +2841,13 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'replaceOwner', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2650,12 +2856,13 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'executeTransaction', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { inputs: [ { name: '_owners', @@ -2674,19 +2881,22 @@ export class AssetProxyOwnerContract extends BaseContract { type: 'uint256', }, ], - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'constructor', }, - { - inputs: [], - outputs: [], + { + inputs: [ + ], + outputs: [ + ], payable: true, stateMutability: 'payable', type: 'fallback', }, - { + { anonymous: false, inputs: [ { @@ -2701,10 +2911,11 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'AssetProxyRegistration', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -2719,10 +2930,11 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'ConfirmationTimeSet', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -2732,10 +2944,11 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'TimeLockChange', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -2750,10 +2963,11 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'Confirmation', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -2768,10 +2982,11 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'Revocation', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -2781,10 +2996,11 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'Submission', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -2794,10 +3010,11 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'Execution', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -2807,10 +3024,11 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'ExecutionFailure', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -2825,10 +3043,11 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'Deposit', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -2838,10 +3057,11 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'OwnerAddition', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -2851,10 +3071,11 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'OwnerRemoval', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -2864,7 +3085,8 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'RequirementChange', - outputs: [], + outputs: [ + ], type: 'event', }, ] as ContractAbi; @@ -2938,15 +3160,15 @@ export class AssetProxyOwnerContract extends BaseContract { ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial) { - super('AssetProxyOwner', AssetProxyOwnerContract.ABI(), address, supportedProvider, txDefaults); + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + super('AssetProxyOwner', AssetProxyOwnerContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( AssetProxyOwnerContract.ABI(), this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts index e75aec7ae0..e708dedb7e 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts @@ -1,7 +1,7 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract'; +import { BaseContract,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -21,8 +21,10 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; +import * as _ from 'lodash'; // tslint:enable:no-unused-variable + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name @@ -33,7 +35,8 @@ export class CoordinatorContract extends BaseContract { signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('hash', hash); assert.isString('signature', signature); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -44,8 +47,10 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as CoordinatorContract; - const encodedData = self._strictEncodeArguments('getSignerAddress(bytes32,bytes)', [hash, signature]); + const self = this as any as CoordinatorContract; + const encodedData = self._strictEncodeArguments('getSignerAddress(bytes32,bytes)', [hash, + signature + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -54,35 +59,38 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getSignerAddress(bytes32,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(hash: string, signature: string): string { + getABIEncodedTransactionData( + hash: string, + signature: string, + ): string { assert.isString('hash', hash); assert.isString('signature', signature); - const self = (this as any) as CoordinatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getSignerAddress(bytes32,bytes)', [ - hash, - signature, - ]); + const self = this as any as CoordinatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getSignerAddress(bytes32,bytes)', [hash, + signature + ]); return abiEncodedTransactionData; }, }; public getTransactionHash = { async callAsync( - transaction: { salt: BigNumber; signerAddress: string; data: string }, + transaction: {salt: BigNumber;signerAddress: string;data: string}, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -91,10 +99,9 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as CoordinatorContract; - const encodedData = self._strictEncodeArguments('getTransactionHash((uint256,address,bytes))', [ - transaction, - ]); + const self = this as any as CoordinatorContract; + const encodedData = self._strictEncodeArguments('getTransactionHash((uint256,address,bytes))', [transaction + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -103,38 +110,35 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + 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); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(transaction: { salt: BigNumber; signerAddress: string; data: string }): string { - const self = (this as any) as CoordinatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'getTransactionHash((uint256,address,bytes))', - [transaction], - ); + getABIEncodedTransactionData( + transaction: {salt: BigNumber;signerAddress: string;data: string}, + ): string { + + const self = this as any as CoordinatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getTransactionHash((uint256,address,bytes))', [transaction + ]); return abiEncodedTransactionData; }, }; public getCoordinatorApprovalHash = { async callAsync( - approval: { - txOrigin: string; - transactionHash: string; - transactionSignature: string; - approvalExpirationTimeSeconds: BigNumber; - }, + approval: {txOrigin: string;transactionHash: string;transactionSignature: string;approvalExpirationTimeSeconds: BigNumber}, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -143,11 +147,9 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as CoordinatorContract; - const encodedData = self._strictEncodeArguments( - 'getCoordinatorApprovalHash((address,bytes32,bytes,uint256))', - [approval], - ); + 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, @@ -156,81 +158,73 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + 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); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(approval: { - txOrigin: string; - transactionHash: string; - transactionSignature: string; - approvalExpirationTimeSeconds: BigNumber; - }): string { - const self = (this as any) as CoordinatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'getCoordinatorApprovalHash((address,bytes32,bytes,uint256))', - [approval], - ); + getABIEncodedTransactionData( + approval: {txOrigin: string;transactionHash: string;transactionSignature: string;approvalExpirationTimeSeconds: BigNumber}, + ): string { + + const self = this as any as CoordinatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getCoordinatorApprovalHash((address,bytes32,bytes,uint256))', [approval + ]); return abiEncodedTransactionData; }, }; public executeTransaction = { async sendTransactionAsync( - transaction: { salt: BigNumber; signerAddress: string; data: string }, + transaction: {salt: BigNumber;signerAddress: string;data: string}, txOrigin: string, transactionSignature: string, approvalExpirationTimeSeconds: BigNumber[], approvalSignatures: string[], - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('txOrigin', txOrigin); - assert.isString('transactionSignature', transactionSignature); - assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); - assert.isArray('approvalSignatures', approvalSignatures); - const self = (this as any) as CoordinatorContract; - const encodedData = self._strictEncodeArguments( - 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', - [ - transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures, - ], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.executeTransaction.estimateGasAsync.bind( - self, - transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures, - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + + assert.isString('txOrigin', txOrigin); + assert.isString('transactionSignature', transactionSignature); + assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); + assert.isArray('approvalSignatures', approvalSignatures); + const self = this as any as CoordinatorContract; + const encodedData = self._strictEncodeArguments('executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.executeTransaction.estimateGasAsync.bind( + self, + transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - transaction: { salt: BigNumber; signerAddress: string; data: string }, + transaction: {salt: BigNumber;signerAddress: string;data: string}, txOrigin: string, transactionSignature: string, approvalExpirationTimeSeconds: BigNumber[], @@ -239,78 +233,76 @@ export class CoordinatorContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('txOrigin', txOrigin); - assert.isString('transactionSignature', transactionSignature); - assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); - assert.isArray('approvalSignatures', approvalSignatures); - const self = (this as any) as CoordinatorContract; - const txHashPromise = self.executeTransaction.sendTransactionAsync( - transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + + assert.isString('txOrigin', txOrigin); + assert.isString('transactionSignature', transactionSignature); + assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); + assert.isArray('approvalSignatures', approvalSignatures); + const self = this as any as CoordinatorContract; + const txHashPromise = self.executeTransaction.sendTransactionAsync(transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - transaction: { salt: BigNumber; signerAddress: string; data: string }, + transaction: {salt: BigNumber;signerAddress: string;data: string}, txOrigin: string, transactionSignature: string, approvalExpirationTimeSeconds: BigNumber[], approvalSignatures: string[], txData?: Partial | undefined, ): Promise { - assert.isString('txOrigin', txOrigin); - assert.isString('transactionSignature', transactionSignature); - assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); - assert.isArray('approvalSignatures', approvalSignatures); - const self = (this as any) as CoordinatorContract; - const encodedData = self._strictEncodeArguments( - 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', - [ - transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures, - ], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + + assert.isString('txOrigin', txOrigin); + assert.isString('transactionSignature', transactionSignature); + assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); + assert.isArray('approvalSignatures', approvalSignatures); + const self = this as any as CoordinatorContract; + const encodedData = self._strictEncodeArguments('executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - transaction: { salt: BigNumber; signerAddress: string; data: string }, + transaction: {salt: BigNumber;signerAddress: string;data: string}, txOrigin: string, transactionSignature: string, approvalExpirationTimeSeconds: BigNumber[], approvalSignatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { + assert.isString('txOrigin', txOrigin); assert.isString('transactionSignature', transactionSignature); assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); @@ -323,17 +315,13 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as CoordinatorContract; - const encodedData = self._strictEncodeArguments( - 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', - [ - transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures, - ], - ); + const self = this as any as CoordinatorContract; + const encodedData = self._strictEncodeArguments('executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -342,47 +330,45 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', - ); + const abiEncoder = self._lookupAbiEncoder('executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - transaction: { salt: BigNumber; signerAddress: string; data: string }, - txOrigin: string, - transactionSignature: string, - approvalExpirationTimeSeconds: BigNumber[], - approvalSignatures: string[], - ): string { + transaction: {salt: BigNumber;signerAddress: string;data: string}, + txOrigin: string, + transactionSignature: string, + approvalExpirationTimeSeconds: BigNumber[], + approvalSignatures: string[], + ): string { + assert.isString('txOrigin', txOrigin); assert.isString('transactionSignature', transactionSignature); assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); assert.isArray('approvalSignatures', approvalSignatures); - const self = (this as any) as CoordinatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', - [ - transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures, - ], - ); + const self = this as any as CoordinatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures + ]); return abiEncodedTransactionData; }, }; public EIP712_EXCHANGE_DOMAIN_HASH = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -391,7 +377,7 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as CoordinatorContract; + const self = this as any as CoordinatorContract; const encodedData = self._strictEncodeArguments('EIP712_EXCHANGE_DOMAIN_HASH()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -401,34 +387,36 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + 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); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as CoordinatorContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as CoordinatorContract; const abiEncodedTransactionData = self._strictEncodeArguments('EIP712_EXCHANGE_DOMAIN_HASH()', []); return abiEncodedTransactionData; }, }; public assertValidCoordinatorApprovals = { async callAsync( - transaction: { salt: BigNumber; signerAddress: string; data: string }, + transaction: {salt: BigNumber;signerAddress: string;data: string}, txOrigin: string, transactionSignature: string, approvalExpirationTimeSeconds: BigNumber[], approvalSignatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { + assert.isString('txOrigin', txOrigin); assert.isString('transactionSignature', transactionSignature); assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); @@ -441,17 +429,13 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as CoordinatorContract; - const encodedData = self._strictEncodeArguments( - 'assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', - [ - transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures, - ], - ); + const self = this as any as CoordinatorContract; + const encodedData = self._strictEncodeArguments('assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -460,42 +444,36 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', - ); + const abiEncoder = self._lookupAbiEncoder('assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - transaction: { salt: BigNumber; signerAddress: string; data: string }, - txOrigin: string, - transactionSignature: string, - approvalExpirationTimeSeconds: BigNumber[], - approvalSignatures: string[], - ): string { + transaction: {salt: BigNumber;signerAddress: string;data: string}, + txOrigin: string, + transactionSignature: string, + approvalExpirationTimeSeconds: BigNumber[], + approvalSignatures: string[], + ): string { + assert.isString('txOrigin', txOrigin); assert.isString('transactionSignature', transactionSignature); assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); assert.isArray('approvalSignatures', approvalSignatures); - const self = (this as any) as CoordinatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', - [ - transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures, - ], - ); + const self = this as any as CoordinatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures + ]); return abiEncodedTransactionData; }, }; @@ -504,21 +482,7 @@ export class CoordinatorContract extends BaseContract { data: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise< - Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }> + ): Promise > { assert.isString('data', data); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -529,8 +493,9 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as CoordinatorContract; - const encodedData = self._strictEncodeArguments('decodeOrdersFromFillData(bytes)', [data]); + const self = this as any as CoordinatorContract; + const encodedData = self._strictEncodeArguments('decodeOrdersFromFillData(bytes)', [data + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -539,42 +504,33 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('decodeOrdersFromFillData(bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue< - Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }> - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue + >(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(data: string): string { + getABIEncodedTransactionData( + data: string, + ): string { assert.isString('data', data); - const self = (this as any) as CoordinatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('decodeOrdersFromFillData(bytes)', [data]); + const self = this as any as CoordinatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('decodeOrdersFromFillData(bytes)', [data + ]); return abiEncodedTransactionData; }, }; public EIP712_COORDINATOR_DOMAIN_HASH = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -583,7 +539,7 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as CoordinatorContract; + const self = this as any as CoordinatorContract; const encodedData = self._strictEncodeArguments('EIP712_COORDINATOR_DOMAIN_HASH()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -593,29 +549,30 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('EIP712_COORDINATOR_DOMAIN_HASH()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as CoordinatorContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as CoordinatorContract; const abiEncodedTransactionData = self._strictEncodeArguments('EIP712_COORDINATOR_DOMAIN_HASH()', []); return abiEncodedTransactionData; }, }; - public static async deployFrom0xArtifactAsync( +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - _exchange: string, + artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + _exchange: string, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -628,14 +585,17 @@ 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); + const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); + return CoordinatorContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, _exchange +); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, - _exchange: string, + abiDependencies: { [contractName: string]: ContractAbi }, + _exchange: string, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -645,17 +605,20 @@ export class CoordinatorContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_exchange] = BaseContract._formatABIDataItemList( + [_exchange +] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [_exchange], + [_exchange +], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_exchange]); + const txData = deployInfo.encode(bytecode, [_exchange +]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -663,17 +626,19 @@ 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(txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = [_exchange]; + const contractInstance = new CoordinatorContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); + contractInstance.constructorArgs = [_exchange +]; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -696,7 +661,7 @@ export class CoordinatorContract extends BaseContract { stateMutability: 'pure', type: 'function', }, - { + { constant: true, inputs: [ { @@ -715,7 +680,7 @@ export class CoordinatorContract extends BaseContract { name: 'data', type: 'bytes', }, - ], + ] }, ], name: 'getTransactionHash', @@ -729,7 +694,7 @@ export class CoordinatorContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -752,7 +717,7 @@ export class CoordinatorContract extends BaseContract { name: 'approvalExpirationTimeSeconds', type: 'uint256', }, - ], + ] }, ], name: 'getCoordinatorApprovalHash', @@ -766,7 +731,7 @@ export class CoordinatorContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -785,7 +750,7 @@ export class CoordinatorContract extends BaseContract { name: 'data', type: 'bytes', }, - ], + ] }, { name: 'txOrigin', @@ -805,14 +770,16 @@ export class CoordinatorContract extends BaseContract { }, ], name: 'executeTransaction', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'EIP712_EXCHANGE_DOMAIN_HASH', outputs: [ { @@ -824,7 +791,7 @@ export class CoordinatorContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -843,7 +810,7 @@ export class CoordinatorContract extends BaseContract { name: 'data', type: 'bytes', }, - ], + ] }, { name: 'txOrigin', @@ -863,12 +830,13 @@ export class CoordinatorContract extends BaseContract { }, ], name: 'assertValidCoordinatorApprovals', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -930,16 +898,17 @@ export class CoordinatorContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, ], payable: false, stateMutability: 'pure', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'EIP712_COORDINATOR_DOMAIN_HASH', outputs: [ { @@ -951,14 +920,15 @@ export class CoordinatorContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { inputs: [ { name: '_exchange', type: 'address', }, ], - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'constructor', @@ -966,11 +936,11 @@ export class CoordinatorContract extends BaseContract { ] as ContractAbi; return abi; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial) { - super('Coordinator', CoordinatorContract.ABI(), address, supportedProvider, txDefaults); + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + super('Coordinator', CoordinatorContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 427ea64aed..1783c8969d 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts @@ -1,14 +1,11 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { - BaseContract, +import { BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager, - PromiseWithTransactionHash, -} from '@0x/base-contract'; + SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -29,9 +26,11 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; +import * as _ from 'lodash'; // tslint:enable:no-unused-variable -export type CoordinatorRegistryEventArgs = CoordinatorRegistryCoordinatorEndpointSetEventArgs; +export type CoordinatorRegistryEventArgs = + | CoordinatorRegistryCoordinatorEndpointSetEventArgs; export enum CoordinatorRegistryEvents { CoordinatorEndpointSet = 'CoordinatorEndpointSet', @@ -42,30 +41,38 @@ export interface CoordinatorRegistryCoordinatorEndpointSetEventArgs extends Deco coordinatorEndpoint: string; } + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class CoordinatorRegistryContract extends BaseContract { public setCoordinatorEndpoint = { - async sendTransactionAsync(coordinatorEndpoint: string, txData?: Partial | undefined): Promise { - assert.isString('coordinatorEndpoint', coordinatorEndpoint); - const self = (this as any) as CoordinatorRegistryContract; - const encodedData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.setCoordinatorEndpoint.estimateGasAsync.bind(self, coordinatorEndpoint), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + coordinatorEndpoint: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('coordinatorEndpoint', coordinatorEndpoint); + const self = this as any as CoordinatorRegistryContract; + const encodedData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.setCoordinatorEndpoint.estimateGasAsync.bind( + self, + coordinatorEndpoint + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( coordinatorEndpoint: string, @@ -73,45 +80,51 @@ export class CoordinatorRegistryContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('coordinatorEndpoint', coordinatorEndpoint); - const self = (this as any) as CoordinatorRegistryContract; - const txHashPromise = self.setCoordinatorEndpoint.sendTransactionAsync(coordinatorEndpoint, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('coordinatorEndpoint', coordinatorEndpoint); + const self = this as any as CoordinatorRegistryContract; + const txHashPromise = self.setCoordinatorEndpoint.sendTransactionAsync(coordinatorEndpoint + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(coordinatorEndpoint: string, txData?: Partial | undefined): Promise { - assert.isString('coordinatorEndpoint', coordinatorEndpoint); - const self = (this as any) as CoordinatorRegistryContract; - const encodedData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + coordinatorEndpoint: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('coordinatorEndpoint', coordinatorEndpoint); + const self = this as any as CoordinatorRegistryContract; + const encodedData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( coordinatorEndpoint: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('coordinatorEndpoint', coordinatorEndpoint); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -121,8 +134,9 @@ export class CoordinatorRegistryContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as CoordinatorRegistryContract; - const encodedData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint]); + const self = this as any as CoordinatorRegistryContract; + const encodedData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -131,24 +145,24 @@ export class CoordinatorRegistryContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('setCoordinatorEndpoint(string)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(coordinatorEndpoint: string): string { + getABIEncodedTransactionData( + coordinatorEndpoint: string, + ): string { assert.isString('coordinatorEndpoint', coordinatorEndpoint); - const self = (this as any) as CoordinatorRegistryContract; - const abiEncodedTransactionData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [ - coordinatorEndpoint, - ]); + const self = this as any as CoordinatorRegistryContract; + const abiEncodedTransactionData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint + ]); return abiEncodedTransactionData; }, }; @@ -157,7 +171,8 @@ export class CoordinatorRegistryContract extends BaseContract { coordinatorOperator: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('coordinatorOperator', coordinatorOperator); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -167,10 +182,9 @@ export class CoordinatorRegistryContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as CoordinatorRegistryContract; - const encodedData = self._strictEncodeArguments('getCoordinatorEndpoint(address)', [ - coordinatorOperator.toLowerCase(), - ]); + const self = this as any as CoordinatorRegistryContract; + const encodedData = self._strictEncodeArguments('getCoordinatorEndpoint(address)', [coordinatorOperator.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -179,32 +193,33 @@ export class CoordinatorRegistryContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getCoordinatorEndpoint(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(coordinatorOperator: string): string { + getABIEncodedTransactionData( + coordinatorOperator: string, + ): string { assert.isString('coordinatorOperator', coordinatorOperator); - const self = (this as any) as CoordinatorRegistryContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getCoordinatorEndpoint(address)', [ - coordinatorOperator.toLowerCase(), - ]); + const self = this as any as CoordinatorRegistryContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getCoordinatorEndpoint(address)', [coordinatorOperator.toLowerCase() + ]); return abiEncodedTransactionData; }, }; - private readonly _subscriptionManager: SubscriptionManager; - public static async deployFrom0xArtifactAsync( +private readonly _subscriptionManager: SubscriptionManager; +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, + artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -217,13 +232,15 @@ export class CoordinatorRegistryContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - return CoordinatorRegistryContract.deployAsync(bytecode, abi, provider, txDefaults); + const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); + return CoordinatorRegistryContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, ); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, + abiDependencies: { [contractName: string]: ContractAbi }, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -233,13 +250,17 @@ export class CoordinatorRegistryContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); + [] = BaseContract._formatABIDataItemList( + constructorAbi.inputs, + [], + BaseContract._bigNumberToString, + ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -247,21 +268,18 @@ export class CoordinatorRegistryContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`CoordinatorRegistry successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new CoordinatorRegistryContract( - txReceipt.contractAddress as string, - provider, - txDefaults, - ); + const contractInstance = new CoordinatorRegistryContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); contractInstance.constructorArgs = []; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: false, inputs: [ { @@ -270,12 +288,13 @@ export class CoordinatorRegistryContract extends BaseContract { }, ], name: 'setCoordinatorEndpoint', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -294,14 +313,16 @@ export class CoordinatorRegistryContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { - inputs: [], - outputs: [], + { + inputs: [ + ], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'constructor', }, - { + { anonymous: false, inputs: [ { @@ -316,7 +337,8 @@ export class CoordinatorRegistryContract extends BaseContract { }, ], name: 'CoordinatorEndpointSet', - outputs: [], + outputs: [ + ], type: 'event', }, ] as ContractAbi; @@ -390,15 +412,15 @@ export class CoordinatorRegistryContract extends BaseContract { ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial) { - super('CoordinatorRegistry', CoordinatorRegistryContract.ABI(), address, supportedProvider, txDefaults); + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + super('CoordinatorRegistry', CoordinatorRegistryContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( CoordinatorRegistryContract.ABI(), this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 7d32562817..e46d11a383 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 @@ -1,14 +1,11 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { - BaseContract, +import { BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager, - PromiseWithTransactionHash, -} from '@0x/base-contract'; + SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -29,9 +26,12 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; +import * as _ from 'lodash'; // tslint:enable:no-unused-variable -export type DummyERC20TokenEventArgs = DummyERC20TokenTransferEventArgs | DummyERC20TokenApprovalEventArgs; +export type DummyERC20TokenEventArgs = + | DummyERC20TokenTransferEventArgs + | DummyERC20TokenApprovalEventArgs; export enum DummyERC20TokenEvents { Transfer = 'Transfer', @@ -50,12 +50,17 @@ export interface DummyERC20TokenApprovalEventArgs extends DecodedLogArgs { _value: BigNumber; } + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class DummyERC20TokenContract extends BaseContract { public name = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -64,7 +69,7 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC20TokenContract; + const self = this as any as DummyERC20TokenContract; const encodedData = self._strictEncodeArguments('name()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -74,20 +79,20 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('name()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as DummyERC20TokenContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as DummyERC20TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('name()', []); return abiEncodedTransactionData; }, @@ -96,30 +101,33 @@ export class DummyERC20TokenContract extends BaseContract { async sendTransactionAsync( _spender: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.approve.estimateGasAsync.bind( + self, _spender.toLowerCase(), - _value, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind(self, _spender.toLowerCase(), _value), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _value + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _spender: string, @@ -128,55 +136,57 @@ export class DummyERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const txHashPromise = self.approve.sendTransactionAsync(_spender.toLowerCase(), _value, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = this as any as DummyERC20TokenContract; + const txHashPromise = self.approve.sendTransactionAsync(_spender.toLowerCase(), + _value + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _spender: string, _value: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ - _spender.toLowerCase(), - _value, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _spender: string, _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -187,11 +197,10 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ - _spender.toLowerCase(), - _value, - ]); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), + _value + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -200,31 +209,36 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_spender: string, _value: BigNumber): string { + getABIEncodedTransactionData( + _spender: string, + _value: BigNumber, + ): string { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [ - _spender.toLowerCase(), - _value, - ]); + const self = this as any as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), + _value + ]); return abiEncodedTransactionData; }, }; public totalSupply = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -233,7 +247,7 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC20TokenContract; + const self = this as any as DummyERC20TokenContract; const encodedData = self._strictEncodeArguments('totalSupply()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -243,20 +257,20 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('totalSupply()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as DummyERC20TokenContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as DummyERC20TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('totalSupply()', []); return abiEncodedTransactionData; }, @@ -266,32 +280,36 @@ export class DummyERC20TokenContract extends BaseContract { _from: string, _to: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferFrom.estimateGasAsync.bind( + self, _from.toLowerCase(), _to.toLowerCase(), - _value, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _value), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _value + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -301,27 +319,25 @@ export class DummyERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const txHashPromise = self.transferFrom.sendTransactionAsync( - _from.toLowerCase(), - _to.toLowerCase(), - _value, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as DummyERC20TokenContract; + const txHashPromise = self.transferFrom.sendTransactionAsync(_from.toLowerCase(), + _to.toLowerCase(), + _value + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -329,29 +345,28 @@ export class DummyERC20TokenContract extends BaseContract { _value: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _value, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -359,7 +374,8 @@ export class DummyERC20TokenContract extends BaseContract { _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_value', _value); @@ -371,12 +387,11 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _value, - ]); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _value + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -385,33 +400,39 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_from: string, _to: string, _value: BigNumber): string { + getABIEncodedTransactionData( + _from: string, + _to: string, + _value: BigNumber, + ): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _value, - ]); + const self = this as any as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _value + ]); return abiEncodedTransactionData; }, }; public decimals = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -420,7 +441,7 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC20TokenContract; + const self = this as any as DummyERC20TokenContract; const encodedData = self._strictEncodeArguments('decimals()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -430,20 +451,20 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('decimals()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as DummyERC20TokenContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as DummyERC20TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('decimals()', []); return abiEncodedTransactionData; }, @@ -453,7 +474,8 @@ export class DummyERC20TokenContract extends BaseContract { _owner: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -463,8 +485,9 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -473,27 +496,33 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_owner: string): string { + getABIEncodedTransactionData( + _owner: string, + ): string { assert.isString('_owner', _owner); - const self = (this as any) as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); + const self = this as any as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public owner = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -502,7 +531,7 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC20TokenContract; + const self = this as any as DummyERC20TokenContract; const encodedData = self._strictEncodeArguments('owner()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -512,26 +541,30 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as DummyERC20TokenContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as DummyERC20TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); return abiEncodedTransactionData; }, }; public symbol = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -540,7 +573,7 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC20TokenContract; + const self = this as any as DummyERC20TokenContract; const encodedData = self._strictEncodeArguments('symbol()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -550,44 +583,51 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('symbol()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as DummyERC20TokenContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as DummyERC20TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('symbol()', []); return abiEncodedTransactionData; }, }; public mint = { - async sendTransactionAsync(_value: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('mint(uint256)', [_value]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.mint.estimateGasAsync.bind(self, _value), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + _value: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('_value', _value); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('mint(uint256)', [_value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.mint.estimateGasAsync.bind( + self, + _value + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _value: BigNumber, @@ -595,41 +635,51 @@ export class DummyERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const txHashPromise = self.mint.sendTransactionAsync(_value, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('_value', _value); + const self = this as any as DummyERC20TokenContract; + const txHashPromise = self.mint.sendTransactionAsync(_value + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(_value: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('mint(uint256)', [_value]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + _value: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('_value', _value); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('mint(uint256)', [_value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(_value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + _value: BigNumber, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isBigNumber('_value', _value); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -639,8 +689,9 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('mint(uint256)', [_value]); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('mint(uint256)', [_value + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -649,22 +700,24 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('mint(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_value: BigNumber): string { + getABIEncodedTransactionData( + _value: BigNumber, + ): string { assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('mint(uint256)', [_value]); + const self = this as any as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('mint(uint256)', [_value + ]); return abiEncodedTransactionData; }, }; @@ -672,27 +725,33 @@ export class DummyERC20TokenContract extends BaseContract { async sendTransactionAsync( _to: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transfer.estimateGasAsync.bind(self, _to.toLowerCase(), _value), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transfer.estimateGasAsync.bind( + self, + _to.toLowerCase(), + _value + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _to: string, @@ -701,48 +760,57 @@ export class DummyERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const txHashPromise = self.transfer.sendTransactionAsync(_to.toLowerCase(), _value, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as DummyERC20TokenContract; + const txHashPromise = self.transfer.sendTransactionAsync(_to.toLowerCase(), + _value + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(_to: string, _value: BigNumber, txData?: Partial | undefined): Promise { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + _to: string, + _value: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _to: string, _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_to', _to); assert.isBigNumber('_value', _value); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -753,8 +821,10 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), + _value + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -763,26 +833,27 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_to: string, _value: BigNumber): string { + getABIEncodedTransactionData( + _to: string, + _value: BigNumber, + ): string { assert.isString('_to', _to); assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [ - _to.toLowerCase(), - _value, - ]); + const self = this as any as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), + _value + ]); return abiEncodedTransactionData; }, }; @@ -792,7 +863,8 @@ export class DummyERC20TokenContract extends BaseContract { _spender: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.isString('_spender', _spender); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -803,11 +875,10 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('allowance(address,address)', [ - _owner.toLowerCase(), - _spender.toLowerCase(), - ]); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('allowance(address,address)', [_owner.toLowerCase(), + _spender.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -816,26 +887,27 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_owner: string, _spender: string): string { + getABIEncodedTransactionData( + _owner: string, + _spender: string, + ): string { assert.isString('_owner', _owner); assert.isString('_spender', _spender); - const self = (this as any) as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [ - _owner.toLowerCase(), - _spender.toLowerCase(), - ]); + const self = this as any as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [_owner.toLowerCase(), + _spender.toLowerCase() + ]); return abiEncodedTransactionData; }, }; @@ -843,30 +915,33 @@ export class DummyERC20TokenContract extends BaseContract { async sendTransactionAsync( _target: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_target', _target); - assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [ + assert.isString('_target', _target); + assert.isBigNumber('_value', _value); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [_target.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.setBalance.estimateGasAsync.bind( + self, _target.toLowerCase(), - _value, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.setBalance.estimateGasAsync.bind(self, _target.toLowerCase(), _value), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _value + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _target: string, @@ -875,55 +950,57 @@ export class DummyERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_target', _target); - assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const txHashPromise = self.setBalance.sendTransactionAsync(_target.toLowerCase(), _value, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_target', _target); + assert.isBigNumber('_value', _value); + const self = this as any as DummyERC20TokenContract; + const txHashPromise = self.setBalance.sendTransactionAsync(_target.toLowerCase(), + _value + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _target: string, _value: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_target', _target); - assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [ - _target.toLowerCase(), - _value, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_target', _target); + assert.isBigNumber('_value', _value); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [_target.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _target: string, _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_target', _target); assert.isBigNumber('_value', _value); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -934,11 +1011,10 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [ - _target.toLowerCase(), - _value, - ]); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [_target.toLowerCase(), + _value + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -947,49 +1023,57 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('setBalance(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_target: string, _value: BigNumber): string { + getABIEncodedTransactionData( + _target: string, + _value: BigNumber, + ): string { assert.isString('_target', _target); assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('setBalance(address,uint256)', [ - _target.toLowerCase(), - _value, - ]); + const self = this as any as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('setBalance(address,uint256)', [_target.toLowerCase(), + _value + ]); return abiEncodedTransactionData; }, }; public transferOwnership = { - async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + newOwner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('newOwner', newOwner); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferOwnership.estimateGasAsync.bind( + self, + newOwner.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( newOwner: string, @@ -997,41 +1081,51 @@ export class DummyERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('newOwner', newOwner); - const self = (this as any) as DummyERC20TokenContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('newOwner', newOwner); + const self = this as any as DummyERC20TokenContract; + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + newOwner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('newOwner', newOwner); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + newOwner: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1041,8 +1135,9 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1051,29 +1146,33 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(newOwner: string): string { + getABIEncodedTransactionData( + newOwner: string, + ): string { assert.isString('newOwner', newOwner); - const self = (this as any) as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ - newOwner.toLowerCase(), - ]); + const self = this as any as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public MAX_MINT_AMOUNT = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -1082,7 +1181,7 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC20TokenContract; + const self = this as any as DummyERC20TokenContract; const encodedData = self._strictEncodeArguments('MAX_MINT_AMOUNT()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1092,33 +1191,34 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('MAX_MINT_AMOUNT()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as DummyERC20TokenContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as DummyERC20TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('MAX_MINT_AMOUNT()', []); return abiEncodedTransactionData; }, }; - private readonly _subscriptionManager: SubscriptionManager; - public static async deployFrom0xArtifactAsync( +private readonly _subscriptionManager: SubscriptionManager; +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - _name: string, - _symbol: string, - _decimals: BigNumber, - _totalSupply: BigNumber, + artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + _name: string, + _symbol: string, + _decimals: BigNumber, + _totalSupply: BigNumber, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -1131,26 +1231,23 @@ export class DummyERC20TokenContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - return DummyERC20TokenContract.deployAsync( - bytecode, - abi, - provider, - txDefaults, - _name, - _symbol, - _decimals, - _totalSupply, - ); + const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); + return DummyERC20TokenContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, _name, +_symbol, +_decimals, +_totalSupply +); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, - _name: string, - _symbol: string, - _decimals: BigNumber, - _totalSupply: BigNumber, + abiDependencies: { [contractName: string]: ContractAbi }, + _name: string, + _symbol: string, + _decimals: BigNumber, + _totalSupply: BigNumber, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -1160,17 +1257,29 @@ export class DummyERC20TokenContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_name, _symbol, _decimals, _totalSupply] = BaseContract._formatABIDataItemList( + [_name, +_symbol, +_decimals, +_totalSupply +] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [_name, _symbol, _decimals, _totalSupply], + [_name, +_symbol, +_decimals, +_totalSupply +], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_name, _symbol, _decimals, _totalSupply]); + const txData = deployInfo.encode(bytecode, [_name, +_symbol, +_decimals, +_totalSupply +]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -1178,19 +1287,25 @@ export class DummyERC20TokenContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`DummyERC20Token successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new DummyERC20TokenContract(txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = [_name, _symbol, _decimals, _totalSupply]; + const contractInstance = new DummyERC20TokenContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); + contractInstance.constructorArgs = [_name, +_symbol, +_decimals, +_totalSupply +]; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'name', outputs: [ { @@ -1202,7 +1317,7 @@ export class DummyERC20TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1225,9 +1340,10 @@ export class DummyERC20TokenContract extends BaseContract { stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'totalSupply', outputs: [ { @@ -1239,7 +1355,7 @@ export class DummyERC20TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1266,9 +1382,10 @@ export class DummyERC20TokenContract extends BaseContract { stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'decimals', outputs: [ { @@ -1280,7 +1397,7 @@ export class DummyERC20TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1299,9 +1416,10 @@ export class DummyERC20TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'owner', outputs: [ { @@ -1313,9 +1431,10 @@ export class DummyERC20TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'symbol', outputs: [ { @@ -1327,7 +1446,7 @@ export class DummyERC20TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1336,12 +1455,13 @@ export class DummyERC20TokenContract extends BaseContract { }, ], name: 'mint', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1364,7 +1484,7 @@ export class DummyERC20TokenContract extends BaseContract { stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1387,7 +1507,7 @@ export class DummyERC20TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1400,12 +1520,13 @@ export class DummyERC20TokenContract extends BaseContract { }, ], name: 'setBalance', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1414,14 +1535,16 @@ export class DummyERC20TokenContract extends BaseContract { }, ], name: 'transferOwnership', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'MAX_MINT_AMOUNT', outputs: [ { @@ -1433,7 +1556,7 @@ export class DummyERC20TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { inputs: [ { name: '_name', @@ -1452,12 +1575,13 @@ export class DummyERC20TokenContract extends BaseContract { type: 'uint256', }, ], - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'constructor', }, - { + { anonymous: false, inputs: [ { @@ -1477,10 +1601,11 @@ export class DummyERC20TokenContract extends BaseContract { }, ], name: 'Transfer', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1500,7 +1625,8 @@ export class DummyERC20TokenContract extends BaseContract { }, ], name: 'Approval', - outputs: [], + outputs: [ + ], type: 'event', }, ] as ContractAbi; @@ -1574,15 +1700,15 @@ export class DummyERC20TokenContract extends BaseContract { ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial) { - super('DummyERC20Token', DummyERC20TokenContract.ABI(), address, supportedProvider, txDefaults); + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + super('DummyERC20Token', DummyERC20TokenContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( DummyERC20TokenContract.ABI(), this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 ad2c8a15b5..095e6bfb3f 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 @@ -1,14 +1,11 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { - BaseContract, +import { BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager, - PromiseWithTransactionHash, -} from '@0x/base-contract'; + SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -29,6 +26,7 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; +import * as _ from 'lodash'; // tslint:enable:no-unused-variable export type DummyERC721TokenEventArgs = @@ -60,12 +58,17 @@ export interface DummyERC721TokenApprovalForAllEventArgs extends DecodedLogArgs _approved: boolean; } + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class DummyERC721TokenContract extends BaseContract { public name = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -74,7 +77,7 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC721TokenContract; + const self = this as any as DummyERC721TokenContract; const encodedData = self._strictEncodeArguments('name()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -84,20 +87,20 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('name()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as DummyERC721TokenContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as DummyERC721TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('name()', []); return abiEncodedTransactionData; }, @@ -107,7 +110,8 @@ export class DummyERC721TokenContract extends BaseContract { _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('_tokenId', _tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -117,8 +121,9 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId]); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -127,22 +132,24 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getApproved(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_tokenId: BigNumber): string { + getABIEncodedTransactionData( + _tokenId: BigNumber, + ): string { assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId]); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId + ]); return abiEncodedTransactionData; }, }; @@ -150,30 +157,33 @@ export class DummyERC721TokenContract extends BaseContract { async sendTransactionAsync( _approved: string, _tokenId: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_approved', _approved); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + assert.isString('_approved', _approved); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(), + _tokenId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.approve.estimateGasAsync.bind( + self, _approved.toLowerCase(), - _tokenId, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind(self, _approved.toLowerCase(), _tokenId), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _tokenId + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _approved: string, @@ -182,55 +192,57 @@ export class DummyERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_approved', _approved); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const txHashPromise = self.approve.sendTransactionAsync(_approved.toLowerCase(), _tokenId, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_approved', _approved); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const txHashPromise = self.approve.sendTransactionAsync(_approved.toLowerCase(), + _tokenId + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _approved: string, _tokenId: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_approved', _approved); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ - _approved.toLowerCase(), - _tokenId, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_approved', _approved); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(), + _tokenId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _approved: string, _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_approved', _approved); assert.isBigNumber('_tokenId', _tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -241,11 +253,10 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ - _approved.toLowerCase(), - _tokenId, - ]); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(), + _tokenId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -254,26 +265,27 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_approved: string, _tokenId: BigNumber): string { + getABIEncodedTransactionData( + _approved: string, + _tokenId: BigNumber, + ): string { assert.isString('_approved', _approved); assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [ - _approved.toLowerCase(), - _tokenId, - ]); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(), + _tokenId + ]); return abiEncodedTransactionData; }, }; @@ -282,32 +294,36 @@ export class DummyERC721TokenContract extends BaseContract { _from: string, _to: string, _tokenId: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferFrom.estimateGasAsync.bind( + self, _from.toLowerCase(), _to.toLowerCase(), - _tokenId, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _tokenId), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _tokenId + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -317,27 +333,25 @@ export class DummyERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const txHashPromise = self.transferFrom.sendTransactionAsync( - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const txHashPromise = self.transferFrom.sendTransactionAsync(_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -345,29 +359,28 @@ export class DummyERC721TokenContract extends BaseContract { _tokenId: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -375,7 +388,8 @@ export class DummyERC721TokenContract extends BaseContract { _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); @@ -387,12 +401,11 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - ]); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -401,28 +414,30 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_from: string, _to: string, _tokenId: BigNumber): string { + getABIEncodedTransactionData( + _from: string, + _to: string, + _tokenId: BigNumber, + ): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - ]); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + ]); return abiEncodedTransactionData; }, }; @@ -430,27 +445,33 @@ export class DummyERC721TokenContract extends BaseContract { async sendTransactionAsync( _to: string, _tokenId: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to.toLowerCase(), _tokenId]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.mint.estimateGasAsync.bind(self, _to.toLowerCase(), _tokenId), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to.toLowerCase(), + _tokenId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.mint.estimateGasAsync.bind( + self, + _to.toLowerCase(), + _tokenId + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _to: string, @@ -459,52 +480,57 @@ export class DummyERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const txHashPromise = self.mint.sendTransactionAsync(_to.toLowerCase(), _tokenId, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const txHashPromise = self.mint.sendTransactionAsync(_to.toLowerCase(), + _tokenId + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _to: string, _tokenId: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to.toLowerCase(), _tokenId]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to.toLowerCase(), + _tokenId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _to: string, _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -515,8 +541,10 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to.toLowerCase(), _tokenId]); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to.toLowerCase(), + _tokenId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -525,26 +553,27 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('mint(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_to: string, _tokenId: BigNumber): string { + getABIEncodedTransactionData( + _to: string, + _tokenId: BigNumber, + ): string { assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('mint(address,uint256)', [ - _to.toLowerCase(), - _tokenId, - ]); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('mint(address,uint256)', [_to.toLowerCase(), + _tokenId + ]); return abiEncodedTransactionData; }, }; @@ -553,32 +582,36 @@ export class DummyERC721TokenContract extends BaseContract { _from: string, _to: string, _tokenId: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.safeTransferFrom1.estimateGasAsync.bind( + self, _from.toLowerCase(), _to.toLowerCase(), - _tokenId, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.safeTransferFrom1.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _tokenId), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _tokenId + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -588,27 +621,25 @@ export class DummyERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const txHashPromise = self.safeTransferFrom1.sendTransactionAsync( - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const txHashPromise = self.safeTransferFrom1.sendTransactionAsync(_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -616,29 +647,28 @@ export class DummyERC721TokenContract extends BaseContract { _tokenId: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -646,7 +676,8 @@ export class DummyERC721TokenContract extends BaseContract { _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); @@ -658,12 +689,11 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - ]); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -672,28 +702,30 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_from: string, _to: string, _tokenId: BigNumber): string { + getABIEncodedTransactionData( + _from: string, + _to: string, + _tokenId: BigNumber, + ): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - ]); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + ]); return abiEncodedTransactionData; }, }; @@ -702,7 +734,8 @@ export class DummyERC721TokenContract extends BaseContract { _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('_tokenId', _tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -712,8 +745,9 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId]); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -722,22 +756,24 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('ownerOf(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_tokenId: BigNumber): string { + getABIEncodedTransactionData( + _tokenId: BigNumber, + ): string { assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId]); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId + ]); return abiEncodedTransactionData; }, }; @@ -746,7 +782,8 @@ export class DummyERC721TokenContract extends BaseContract { _owner: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -756,8 +793,9 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -766,27 +804,33 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_owner: string): string { + getABIEncodedTransactionData( + _owner: string, + ): string { assert.isString('_owner', _owner); - const self = (this as any) as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public owner = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -795,7 +839,7 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC721TokenContract; + const self = this as any as DummyERC721TokenContract; const encodedData = self._strictEncodeArguments('owner()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -805,26 +849,30 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as DummyERC721TokenContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as DummyERC721TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); return abiEncodedTransactionData; }, }; public symbol = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -833,7 +881,7 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC721TokenContract; + const self = this as any as DummyERC721TokenContract; const encodedData = self._strictEncodeArguments('symbol()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -843,20 +891,20 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('symbol()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as DummyERC721TokenContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as DummyERC721TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('symbol()', []); return abiEncodedTransactionData; }, @@ -865,27 +913,33 @@ export class DummyERC721TokenContract extends BaseContract { async sendTransactionAsync( _owner: string, _tokenId: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_owner', _owner); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner.toLowerCase(), _tokenId]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.burn.estimateGasAsync.bind(self, _owner.toLowerCase(), _tokenId), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isString('_owner', _owner); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner.toLowerCase(), + _tokenId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.burn.estimateGasAsync.bind( + self, + _owner.toLowerCase(), + _tokenId + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _owner: string, @@ -894,52 +948,57 @@ export class DummyERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_owner', _owner); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const txHashPromise = self.burn.sendTransactionAsync(_owner.toLowerCase(), _tokenId, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_owner', _owner); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const txHashPromise = self.burn.sendTransactionAsync(_owner.toLowerCase(), + _tokenId + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _owner: string, _tokenId: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_owner', _owner); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner.toLowerCase(), _tokenId]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_owner', _owner); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner.toLowerCase(), + _tokenId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _owner: string, _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.isBigNumber('_tokenId', _tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -950,8 +1009,10 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner.toLowerCase(), _tokenId]); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner.toLowerCase(), + _tokenId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -960,26 +1021,27 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('burn(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_owner: string, _tokenId: BigNumber): string { + getABIEncodedTransactionData( + _owner: string, + _tokenId: BigNumber, + ): string { assert.isString('_owner', _owner); assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('burn(address,uint256)', [ - _owner.toLowerCase(), - _tokenId, - ]); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('burn(address,uint256)', [_owner.toLowerCase(), + _tokenId + ]); return abiEncodedTransactionData; }, }; @@ -987,30 +1049,33 @@ export class DummyERC721TokenContract extends BaseContract { async sendTransactionAsync( _operator: string, _approved: boolean, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_operator', _operator); - assert.isBoolean('_approved', _approved); - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ + assert.isString('_operator', _operator); + assert.isBoolean('_approved', _approved); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(), + _approved + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.setApprovalForAll.estimateGasAsync.bind( + self, _operator.toLowerCase(), - _approved, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.setApprovalForAll.estimateGasAsync.bind(self, _operator.toLowerCase(), _approved), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _approved + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _operator: string, @@ -1019,59 +1084,57 @@ export class DummyERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_operator', _operator); - assert.isBoolean('_approved', _approved); - const self = (this as any) as DummyERC721TokenContract; - const txHashPromise = self.setApprovalForAll.sendTransactionAsync( - _operator.toLowerCase(), - _approved, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_operator', _operator); + assert.isBoolean('_approved', _approved); + const self = this as any as DummyERC721TokenContract; + const txHashPromise = self.setApprovalForAll.sendTransactionAsync(_operator.toLowerCase(), + _approved + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _operator: string, _approved: boolean, txData?: Partial | undefined, ): Promise { - assert.isString('_operator', _operator); - assert.isBoolean('_approved', _approved); - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ - _operator.toLowerCase(), - _approved, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_operator', _operator); + assert.isBoolean('_approved', _approved); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(), + _approved + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _operator: string, _approved: boolean, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_operator', _operator); assert.isBoolean('_approved', _approved); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -1082,11 +1145,10 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ - _operator.toLowerCase(), - _approved, - ]); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(), + _approved + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1095,26 +1157,27 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_operator: string, _approved: boolean): string { + getABIEncodedTransactionData( + _operator: string, + _approved: boolean, + ): string { assert.isString('_operator', _operator); assert.isBoolean('_approved', _approved); - const self = (this as any) as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ - _operator.toLowerCase(), - _approved, - ]); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(), + _approved + ]); return abiEncodedTransactionData; }, }; @@ -1124,40 +1187,39 @@ export class DummyERC721TokenContract extends BaseContract { _to: string, _tokenId: BigNumber, _data: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - assert.isString('_data', _data); - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [ + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + assert.isString('_data', _data); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.safeTransferFrom2.estimateGasAsync.bind( + self, _from.toLowerCase(), _to.toLowerCase(), _tokenId, - _data, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.safeTransferFrom2.estimateGasAsync.bind( - self, - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data, - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _data + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -1168,29 +1230,27 @@ export class DummyERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - assert.isString('_data', _data); - const self = (this as any) as DummyERC721TokenContract; - const txHashPromise = self.safeTransferFrom2.sendTransactionAsync( - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + assert.isString('_data', _data); + const self = this as any as DummyERC721TokenContract; + const txHashPromise = self.safeTransferFrom2.sendTransactionAsync(_from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -1199,31 +1259,30 @@ export class DummyERC721TokenContract extends BaseContract { _data: string, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - assert.isString('_data', _data); - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + assert.isString('_data', _data); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -1232,7 +1291,8 @@ export class DummyERC721TokenContract extends BaseContract { _data: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); @@ -1245,13 +1305,12 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data, - ]); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1260,28 +1319,33 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_from: string, _to: string, _tokenId: BigNumber, _data: string): string { + getABIEncodedTransactionData( + _from: string, + _to: string, + _tokenId: BigNumber, + _data: string, + ): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); assert.isString('_data', _data); - const self = (this as any) as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'safeTransferFrom(address,address,uint256,bytes)', - [_from.toLowerCase(), _to.toLowerCase(), _tokenId, _data], - ); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data + ]); return abiEncodedTransactionData; }, }; @@ -1291,7 +1355,8 @@ export class DummyERC721TokenContract extends BaseContract { _operator: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.isString('_operator', _operator); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -1302,11 +1367,10 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('isApprovedForAll(address,address)', [ - _owner.toLowerCase(), - _operator.toLowerCase(), - ]); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('isApprovedForAll(address,address)', [_owner.toLowerCase(), + _operator.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1315,49 +1379,57 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isApprovedForAll(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_owner: string, _operator: string): string { + getABIEncodedTransactionData( + _owner: string, + _operator: string, + ): string { assert.isString('_owner', _owner); assert.isString('_operator', _operator); - const self = (this as any) as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('isApprovedForAll(address,address)', [ - _owner.toLowerCase(), - _operator.toLowerCase(), - ]); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isApprovedForAll(address,address)', [_owner.toLowerCase(), + _operator.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public transferOwnership = { - async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + newOwner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('newOwner', newOwner); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferOwnership.estimateGasAsync.bind( + self, + newOwner.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( newOwner: string, @@ -1365,41 +1437,51 @@ export class DummyERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('newOwner', newOwner); - const self = (this as any) as DummyERC721TokenContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('newOwner', newOwner); + const self = this as any as DummyERC721TokenContract; + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + newOwner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('newOwner', newOwner); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + newOwner: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1409,8 +1491,9 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1419,34 +1502,35 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(newOwner: string): string { + getABIEncodedTransactionData( + newOwner: string, + ): string { assert.isString('newOwner', newOwner); - const self = (this as any) as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ - newOwner.toLowerCase(), - ]); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); return abiEncodedTransactionData; }, }; - private readonly _subscriptionManager: SubscriptionManager; - public static async deployFrom0xArtifactAsync( +private readonly _subscriptionManager: SubscriptionManager; +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - _name: string, - _symbol: string, + artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + _name: string, + _symbol: string, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -1459,15 +1543,19 @@ export class DummyERC721TokenContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - return DummyERC721TokenContract.deployAsync(bytecode, abi, provider, txDefaults, _name, _symbol); + const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); + return DummyERC721TokenContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, _name, +_symbol +); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, - _name: string, - _symbol: string, + abiDependencies: { [contractName: string]: ContractAbi }, + _name: string, + _symbol: string, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -1477,17 +1565,23 @@ export class DummyERC721TokenContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_name, _symbol] = BaseContract._formatABIDataItemList( + [_name, +_symbol +] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [_name, _symbol], + [_name, +_symbol +], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_name, _symbol]); + const txData = deployInfo.encode(bytecode, [_name, +_symbol +]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -1495,23 +1589,23 @@ export class DummyERC721TokenContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`DummyERC721Token successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new DummyERC721TokenContract( - txReceipt.contractAddress as string, - provider, - txDefaults, - ); - contractInstance.constructorArgs = [_name, _symbol]; + const contractInstance = new DummyERC721TokenContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); + contractInstance.constructorArgs = [_name, +_symbol +]; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'name', outputs: [ { @@ -1523,7 +1617,7 @@ export class DummyERC721TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1542,7 +1636,7 @@ export class DummyERC721TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1555,12 +1649,13 @@ export class DummyERC721TokenContract extends BaseContract { }, ], name: 'approve', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1577,12 +1672,13 @@ export class DummyERC721TokenContract extends BaseContract { }, ], name: 'transferFrom', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1595,12 +1691,13 @@ export class DummyERC721TokenContract extends BaseContract { }, ], name: 'mint', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1617,12 +1714,13 @@ export class DummyERC721TokenContract extends BaseContract { }, ], name: 'safeTransferFrom', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1641,7 +1739,7 @@ export class DummyERC721TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1660,9 +1758,10 @@ export class DummyERC721TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'owner', outputs: [ { @@ -1674,9 +1773,10 @@ export class DummyERC721TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'symbol', outputs: [ { @@ -1688,7 +1788,7 @@ export class DummyERC721TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1701,12 +1801,13 @@ export class DummyERC721TokenContract extends BaseContract { }, ], name: 'burn', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1719,12 +1820,13 @@ export class DummyERC721TokenContract extends BaseContract { }, ], name: 'setApprovalForAll', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1745,12 +1847,13 @@ export class DummyERC721TokenContract extends BaseContract { }, ], name: 'safeTransferFrom', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1773,7 +1876,7 @@ export class DummyERC721TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1782,12 +1885,13 @@ export class DummyERC721TokenContract extends BaseContract { }, ], name: 'transferOwnership', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { inputs: [ { name: '_name', @@ -1798,12 +1902,13 @@ export class DummyERC721TokenContract extends BaseContract { type: 'string', }, ], - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'constructor', }, - { + { anonymous: false, inputs: [ { @@ -1823,10 +1928,11 @@ export class DummyERC721TokenContract extends BaseContract { }, ], name: 'Transfer', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1846,10 +1952,11 @@ export class DummyERC721TokenContract extends BaseContract { }, ], name: 'Approval', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1869,7 +1976,8 @@ export class DummyERC721TokenContract extends BaseContract { }, ], name: 'ApprovalForAll', - outputs: [], + outputs: [ + ], type: 'event', }, ] as ContractAbi; @@ -1943,15 +2051,15 @@ export class DummyERC721TokenContract extends BaseContract { ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial) { - super('DummyERC721Token', DummyERC721TokenContract.ABI(), address, supportedProvider, txDefaults); + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + super('DummyERC721Token', DummyERC721TokenContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( DummyERC721TokenContract.ABI(), this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 bb8ef3ad4b..27db00ac50 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts @@ -1,7 +1,7 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract'; +import { BaseContract,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -21,146 +21,94 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; +import * as _ from 'lodash'; // tslint:enable:no-unused-variable + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class DutchAuctionContract extends BaseContract { public getAuctionDetails = { async sendTransactionAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - txData?: Partial | undefined, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + txData?: Partial | undefined, ): Promise { - const self = (this as any) as DutchAuctionContract; - const encodedData = self._strictEncodeArguments( - 'getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', - [order], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.getAuctionDetails.estimateGasAsync.bind(self, order), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + + const self = this as any as DutchAuctionContract; + const encodedData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.getAuctionDetails.estimateGasAsync.bind( + self, + order + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - const self = (this as any) as DutchAuctionContract; - const txHashPromise = self.getAuctionDetails.sendTransactionAsync(order, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + + const self = this as any as DutchAuctionContract; + const txHashPromise = self.getAuctionDetails.sendTransactionAsync(order + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, txData?: Partial | undefined, ): Promise { - const self = (this as any) as DutchAuctionContract; - const encodedData = self._strictEncodeArguments( - 'getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', - [order], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + + const self = this as any as DutchAuctionContract; + const encodedData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{ - beginTimeSeconds: BigNumber; - endTimeSeconds: BigNumber; - beginAmount: BigNumber; - endAmount: BigNumber; - currentAmount: BigNumber; - currentTimeSeconds: BigNumber; - }> { + ): Promise<{beginTimeSeconds: BigNumber;endTimeSeconds: BigNumber;beginAmount: BigNumber;endAmount: BigNumber;currentAmount: BigNumber;currentTimeSeconds: BigNumber} + > { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -169,11 +117,9 @@ export class DutchAuctionContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DutchAuctionContract; - const encodedData = self._strictEncodeArguments( - 'getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', - [order], - ); + const self = this as any as DutchAuctionContract; + const encodedData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -182,266 +128,141 @@ export class DutchAuctionContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', - ); + const abiEncoder = self._lookupAbiEncoder('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ - beginTimeSeconds: BigNumber; - endTimeSeconds: BigNumber; - beginAmount: BigNumber; - endAmount: BigNumber; - currentAmount: BigNumber; - currentTimeSeconds: BigNumber; - }>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{beginTimeSeconds: BigNumber;endTimeSeconds: BigNumber;beginAmount: BigNumber;endAmount: BigNumber;currentAmount: BigNumber;currentTimeSeconds: BigNumber} + >(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }): string { - const self = (this as any) as DutchAuctionContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', - [order], - ); + getABIEncodedTransactionData( + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + ): string { + + const self = this as any as DutchAuctionContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order + ]); return abiEncodedTransactionData; }, }; public matchOrders = { async sendTransactionAsync( - buyOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - sellOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, buySignature: string, sellSignature: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('buySignature', buySignature); - assert.isString('sellSignature', sellSignature); - const self = (this as any) as DutchAuctionContract; - const encodedData = self._strictEncodeArguments( - 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', - [buyOrder, sellOrder, buySignature, sellSignature], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.matchOrders.estimateGasAsync.bind(self, buyOrder, sellOrder, buySignature, sellSignature), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + + + assert.isString('buySignature', buySignature); + assert.isString('sellSignature', sellSignature); + const self = this as any as DutchAuctionContract; + const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [buyOrder, + sellOrder, + buySignature, + sellSignature + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.matchOrders.estimateGasAsync.bind( + self, + buyOrder, + sellOrder, + buySignature, + sellSignature + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - buyOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - sellOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, buySignature: string, sellSignature: string, txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('buySignature', buySignature); - assert.isString('sellSignature', sellSignature); - const self = (this as any) as DutchAuctionContract; - const txHashPromise = self.matchOrders.sendTransactionAsync( - buyOrder, - sellOrder, - buySignature, - sellSignature, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + + + assert.isString('buySignature', buySignature); + assert.isString('sellSignature', sellSignature); + const self = this as any as DutchAuctionContract; + const txHashPromise = self.matchOrders.sendTransactionAsync(buyOrder, + sellOrder, + buySignature, + sellSignature + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - buyOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - sellOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, buySignature: string, sellSignature: string, txData?: Partial | undefined, ): Promise { - assert.isString('buySignature', buySignature); - assert.isString('sellSignature', sellSignature); - const self = (this as any) as DutchAuctionContract; - const encodedData = self._strictEncodeArguments( - 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', - [buyOrder, sellOrder, buySignature, sellSignature], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + + + assert.isString('buySignature', buySignature); + assert.isString('sellSignature', sellSignature); + const self = this as any as DutchAuctionContract; + const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [buyOrder, + sellOrder, + buySignature, + sellSignature + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - buyOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - sellOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, buySignature: string, sellSignature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{ - left: { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }; - right: { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }; - leftMakerAssetSpreadAmount: BigNumber; - }> { + ): Promise<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber} + > { + + assert.isString('buySignature', buySignature); assert.isString('sellSignature', sellSignature); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -452,11 +273,12 @@ export class DutchAuctionContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DutchAuctionContract; - const encodedData = self._strictEncodeArguments( - 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', - [buyOrder, sellOrder, buySignature, sellSignature], - ); + const self = this as any as DutchAuctionContract; + const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [buyOrder, + sellOrder, + buySignature, + sellSignature + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -465,81 +287,42 @@ export class DutchAuctionContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(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)', - ); + const abiEncoder = self._lookupAbiEncoder('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ - left: { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }; - right: { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }; - leftMakerAssetSpreadAmount: BigNumber; - }>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber} + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - buyOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - sellOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - buySignature: string, - sellSignature: string, - ): string { + buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + buySignature: string, + sellSignature: string, + ): string { + + assert.isString('buySignature', buySignature); assert.isString('sellSignature', sellSignature); - const self = (this as any) as DutchAuctionContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', - [buyOrder, sellOrder, buySignature, sellSignature], - ); + const self = this as any as DutchAuctionContract; + const abiEncodedTransactionData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [buyOrder, + sellOrder, + buySignature, + sellSignature + ]); return abiEncodedTransactionData; }, }; - public static async deployFrom0xArtifactAsync( +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - _exchange: string, + artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + _exchange: string, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -552,14 +335,17 @@ export class DutchAuctionContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - return DutchAuctionContract.deployAsync(bytecode, abi, provider, txDefaults, _exchange); + const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); + return DutchAuctionContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, _exchange +); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, - _exchange: string, + abiDependencies: { [contractName: string]: ContractAbi }, + _exchange: string, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -569,17 +355,20 @@ export class DutchAuctionContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_exchange] = BaseContract._formatABIDataItemList( + [_exchange +] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [_exchange], + [_exchange +], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_exchange]); + const txData = deployInfo.encode(bytecode, [_exchange +]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -587,17 +376,19 @@ export class DutchAuctionContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`DutchAuction successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new DutchAuctionContract(txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = [_exchange]; + const contractInstance = new DutchAuctionContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); + contractInstance.constructorArgs = [_exchange +]; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: false, inputs: [ { @@ -652,7 +443,7 @@ export class DutchAuctionContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, ], name: 'getAuctionDetails', @@ -685,14 +476,14 @@ export class DutchAuctionContract extends BaseContract { name: 'currentTimeSeconds', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -747,7 +538,7 @@ export class DutchAuctionContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'sellOrder', @@ -801,7 +592,7 @@ export class DutchAuctionContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'buySignature', @@ -838,7 +629,7 @@ export class DutchAuctionContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, { name: 'right', @@ -860,27 +651,28 @@ export class DutchAuctionContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, { name: 'leftMakerAssetSpreadAmount', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { inputs: [ { name: '_exchange', type: 'address', }, ], - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'constructor', @@ -888,11 +680,11 @@ export class DutchAuctionContract extends BaseContract { ] as ContractAbi; return abi; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial) { - super('DutchAuction', DutchAuctionContract.ABI(), address, supportedProvider, txDefaults); + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + super('DutchAuction', DutchAuctionContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 e9dbd86a3a..a72fb0c2c6 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts @@ -1,14 +1,11 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { - BaseContract, +import { BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager, - PromiseWithTransactionHash, -} from '@0x/base-contract'; + SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -29,6 +26,7 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; +import * as _ from 'lodash'; // tslint:enable:no-unused-variable export type ERC20ProxyEventArgs = @@ -50,30 +48,38 @@ export interface ERC20ProxyAuthorizedAddressRemovedEventArgs extends DecodedLogA caller: string; } + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class ERC20ProxyContract extends BaseContract { public addAuthorizedAddress = { - async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.addAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + target: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('target', target); + const self = this as any as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.addAuthorizedAddress.estimateGasAsync.bind( + self, + target.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -81,41 +87,51 @@ export class ERC20ProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = (this as any) as ERC20ProxyContract; - const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + const self = this as any as ERC20ProxyContract; + const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + target: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('target', target); + const self = this as any as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + target: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('target', target); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -125,8 +141,9 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); + const self = this as any as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -135,24 +152,24 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(target: string): string { + getABIEncodedTransactionData( + target: string, + ): string { assert.isString('target', target); - const self = (this as any) as ERC20ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [ - target.toLowerCase(), - ]); + const self = this as any as ERC20ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() + ]); return abiEncodedTransactionData; }, }; @@ -161,7 +178,8 @@ export class ERC20ProxyContract extends BaseContract { index_0: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -171,8 +189,9 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0]); + const self = this as any as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0 + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -181,45 +200,54 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: BigNumber): string { + getABIEncodedTransactionData( + index_0: BigNumber, + ): string { assert.isBigNumber('index_0', index_0); - const self = (this as any) as ERC20ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('authorities(uint256)', [index_0]); + const self = this as any as ERC20ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('authorities(uint256)', [index_0 + ]); return abiEncodedTransactionData; }, }; public removeAuthorizedAddress = { - async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + target: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('target', target); + const self = this as any as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeAuthorizedAddress.estimateGasAsync.bind( + self, + target.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -227,41 +255,51 @@ export class ERC20ProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = (this as any) as ERC20ProxyContract; - const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + const self = this as any as ERC20ProxyContract; + const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + target: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('target', target); + const self = this as any as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + target: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('target', target); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -271,8 +309,9 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); + const self = this as any as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -281,29 +320,33 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(target: string): string { + getABIEncodedTransactionData( + target: string, + ): string { assert.isString('target', target); - const self = (this as any) as ERC20ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [ - target.toLowerCase(), - ]); + const self = this as any as ERC20ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public owner = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -312,7 +355,7 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC20ProxyContract; + const self = this as any as ERC20ProxyContract; const encodedData = self._strictEncodeArguments('owner()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -322,20 +365,20 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as ERC20ProxyContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as ERC20ProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); return abiEncodedTransactionData; }, @@ -344,30 +387,33 @@ export class ERC20ProxyContract extends BaseContract { async sendTransactionAsync( target: string, index: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = this as any as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), + index + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind( + self, target.toLowerCase(), - index, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(self, target.toLowerCase(), index), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + index + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -376,59 +422,57 @@ export class ERC20ProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as ERC20ProxyContract; - const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync( - target.toLowerCase(), - index, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = this as any as ERC20ProxyContract; + const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync(target.toLowerCase(), + index + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( target: string, index: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target.toLowerCase(), - index, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = this as any as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), + index + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( target: string, index: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('target', target); assert.isBigNumber('index', index); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -439,11 +483,10 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target.toLowerCase(), - index, - ]); + const self = this as any as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), + index + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -452,31 +495,36 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(target: string, index: BigNumber): string { + getABIEncodedTransactionData( + target: string, + index: BigNumber, + ): string { assert.isString('target', target); assert.isBigNumber('index', index); - const self = (this as any) as ERC20ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'removeAuthorizedAddressAtIndex(address,uint256)', - [target.toLowerCase(), index], - ); + const self = this as any as ERC20ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), + index + ]); return abiEncodedTransactionData; }, }; public getProxyId = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -485,7 +533,7 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC20ProxyContract; + const self = this as any as ERC20ProxyContract; const encodedData = self._strictEncodeArguments('getProxyId()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -495,20 +543,20 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getProxyId()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as ERC20ProxyContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as ERC20ProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('getProxyId()', []); return abiEncodedTransactionData; }, @@ -518,7 +566,8 @@ export class ERC20ProxyContract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -528,8 +577,9 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase()]); + const self = this as any as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -538,29 +588,33 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorized(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: string): string { + getABIEncodedTransactionData( + index_0: string, + ): string { assert.isString('index_0', index_0); - const self = (this as any) as ERC20ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [ - index_0.toLowerCase(), - ]); + const self = this as any as ERC20ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public getAuthorizedAddresses = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -569,7 +623,7 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC20ProxyContract; + const self = this as any as ERC20ProxyContract; const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -579,44 +633,51 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as ERC20ProxyContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as ERC20ProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('getAuthorizedAddresses()', []); return abiEncodedTransactionData; }, }; public transferOwnership = { - async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + newOwner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('newOwner', newOwner); + const self = this as any as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferOwnership.estimateGasAsync.bind( + self, + newOwner.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( newOwner: string, @@ -624,41 +685,51 @@ export class ERC20ProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('newOwner', newOwner); - const self = (this as any) as ERC20ProxyContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('newOwner', newOwner); + const self = this as any as ERC20ProxyContract; + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + newOwner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('newOwner', newOwner); + const self = this as any as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + newOwner: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -668,8 +739,9 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const self = this as any as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -678,32 +750,33 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(newOwner: string): string { + getABIEncodedTransactionData( + newOwner: string, + ): string { assert.isString('newOwner', newOwner); - const self = (this as any) as ERC20ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ - newOwner.toLowerCase(), - ]); + const self = this as any as ERC20ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); return abiEncodedTransactionData; }, }; - private readonly _subscriptionManager: SubscriptionManager; - public static async deployFrom0xArtifactAsync( +private readonly _subscriptionManager: SubscriptionManager; +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, + artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -716,13 +789,15 @@ export class ERC20ProxyContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - return ERC20ProxyContract.deployAsync(bytecode, abi, provider, txDefaults); + const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); + return ERC20ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, ); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, + abiDependencies: { [contractName: string]: ContractAbi }, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -732,13 +807,17 @@ export class ERC20ProxyContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); + [] = BaseContract._formatABIDataItemList( + constructorAbi.inputs, + [], + BaseContract._bigNumberToString, + ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -746,17 +825,18 @@ export class ERC20ProxyContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`ERC20Proxy successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ERC20ProxyContract(txReceipt.contractAddress as string, provider, txDefaults); + const contractInstance = new ERC20ProxyContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); contractInstance.constructorArgs = []; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: false, inputs: [ { @@ -765,12 +845,13 @@ export class ERC20ProxyContract extends BaseContract { }, ], name: 'addAuthorizedAddress', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -789,7 +870,7 @@ export class ERC20ProxyContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -798,14 +879,16 @@ export class ERC20ProxyContract extends BaseContract { }, ], name: 'removeAuthorizedAddress', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'owner', outputs: [ { @@ -817,7 +900,7 @@ export class ERC20ProxyContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -830,14 +913,16 @@ export class ERC20ProxyContract extends BaseContract { }, ], name: 'removeAuthorizedAddressAtIndex', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'getProxyId', outputs: [ { @@ -849,7 +934,7 @@ export class ERC20ProxyContract extends BaseContract { stateMutability: 'pure', type: 'function', }, - { + { constant: true, inputs: [ { @@ -868,9 +953,10 @@ export class ERC20ProxyContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'getAuthorizedAddresses', outputs: [ { @@ -882,7 +968,7 @@ export class ERC20ProxyContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -891,19 +977,22 @@ export class ERC20ProxyContract extends BaseContract { }, ], name: 'transferOwnership', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { - inputs: [], - outputs: [], + { + inputs: [ + ], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'fallback', }, - { + { anonymous: false, inputs: [ { @@ -918,10 +1007,11 @@ export class ERC20ProxyContract extends BaseContract { }, ], name: 'AuthorizedAddressAdded', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -936,7 +1026,8 @@ export class ERC20ProxyContract extends BaseContract { }, ], name: 'AuthorizedAddressRemoved', - outputs: [], + outputs: [ + ], type: 'event', }, ] as ContractAbi; @@ -1010,15 +1101,15 @@ export class ERC20ProxyContract extends BaseContract { ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial) { - super('ERC20Proxy', ERC20ProxyContract.ABI(), address, supportedProvider, txDefaults); + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + super('ERC20Proxy', ERC20ProxyContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( ERC20ProxyContract.ABI(), this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 d8c303fef3..2985e6d710 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts @@ -1,14 +1,11 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { - BaseContract, +import { BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager, - PromiseWithTransactionHash, -} from '@0x/base-contract'; + SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -29,9 +26,12 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; +import * as _ from 'lodash'; // tslint:enable:no-unused-variable -export type ERC20TokenEventArgs = ERC20TokenTransferEventArgs | ERC20TokenApprovalEventArgs; +export type ERC20TokenEventArgs = + | ERC20TokenTransferEventArgs + | ERC20TokenApprovalEventArgs; export enum ERC20TokenEvents { Transfer = 'Transfer', @@ -50,6 +50,7 @@ export interface ERC20TokenApprovalEventArgs extends DecodedLogArgs { _value: BigNumber; } + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name @@ -58,30 +59,33 @@ export class ERC20TokenContract extends BaseContract { async sendTransactionAsync( _spender: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = (this as any) as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = this as any as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.approve.estimateGasAsync.bind( + self, _spender.toLowerCase(), - _value, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind(self, _spender.toLowerCase(), _value), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _value + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _spender: string, @@ -90,55 +94,57 @@ export class ERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = (this as any) as ERC20TokenContract; - const txHashPromise = self.approve.sendTransactionAsync(_spender.toLowerCase(), _value, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = this as any as ERC20TokenContract; + const txHashPromise = self.approve.sendTransactionAsync(_spender.toLowerCase(), + _value + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _spender: string, _value: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = (this as any) as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ - _spender.toLowerCase(), - _value, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = this as any as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _spender: string, _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -149,11 +155,10 @@ export class ERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ - _spender.toLowerCase(), - _value, - ]); + const self = this as any as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), + _value + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -162,31 +167,36 @@ export class ERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_spender: string, _value: BigNumber): string { + getABIEncodedTransactionData( + _spender: string, + _value: BigNumber, + ): string { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); - const self = (this as any) as ERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [ - _spender.toLowerCase(), - _value, - ]); + const self = this as any as ERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), + _value + ]); return abiEncodedTransactionData; }, }; public totalSupply = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -195,7 +205,7 @@ export class ERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC20TokenContract; + const self = this as any as ERC20TokenContract; const encodedData = self._strictEncodeArguments('totalSupply()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -205,20 +215,20 @@ export class ERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('totalSupply()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as ERC20TokenContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as ERC20TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('totalSupply()', []); return abiEncodedTransactionData; }, @@ -228,32 +238,36 @@ export class ERC20TokenContract extends BaseContract { _from: string, _to: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferFrom.estimateGasAsync.bind( + self, _from.toLowerCase(), _to.toLowerCase(), - _value, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _value), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _value + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -263,27 +277,25 @@ export class ERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as ERC20TokenContract; - const txHashPromise = self.transferFrom.sendTransactionAsync( - _from.toLowerCase(), - _to.toLowerCase(), - _value, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as ERC20TokenContract; + const txHashPromise = self.transferFrom.sendTransactionAsync(_from.toLowerCase(), + _to.toLowerCase(), + _value + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -291,29 +303,28 @@ export class ERC20TokenContract extends BaseContract { _value: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _value, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -321,7 +332,8 @@ export class ERC20TokenContract extends BaseContract { _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_value', _value); @@ -333,12 +345,11 @@ export class ERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _value, - ]); + const self = this as any as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _value + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -347,28 +358,30 @@ export class ERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_from: string, _to: string, _value: BigNumber): string { + getABIEncodedTransactionData( + _from: string, + _to: string, + _value: BigNumber, + ): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_value', _value); - const self = (this as any) as ERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _value, - ]); + const self = this as any as ERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _value + ]); return abiEncodedTransactionData; }, }; @@ -377,7 +390,8 @@ export class ERC20TokenContract extends BaseContract { _owner: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -387,8 +401,9 @@ export class ERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); + const self = this as any as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -397,22 +412,24 @@ export class ERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_owner: string): string { + getABIEncodedTransactionData( + _owner: string, + ): string { assert.isString('_owner', _owner); - const self = (this as any) as ERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); + const self = this as any as ERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() + ]); return abiEncodedTransactionData; }, }; @@ -420,27 +437,33 @@ export class ERC20TokenContract extends BaseContract { async sendTransactionAsync( _to: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transfer.estimateGasAsync.bind(self, _to.toLowerCase(), _value), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transfer.estimateGasAsync.bind( + self, + _to.toLowerCase(), + _value + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _to: string, @@ -449,48 +472,57 @@ export class ERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as ERC20TokenContract; - const txHashPromise = self.transfer.sendTransactionAsync(_to.toLowerCase(), _value, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as ERC20TokenContract; + const txHashPromise = self.transfer.sendTransactionAsync(_to.toLowerCase(), + _value + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(_to: string, _value: BigNumber, txData?: Partial | undefined): Promise { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + _to: string, + _value: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _to: string, _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_to', _to); assert.isBigNumber('_value', _value); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -501,8 +533,10 @@ export class ERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); + const self = this as any as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), + _value + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -511,26 +545,27 @@ export class ERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_to: string, _value: BigNumber): string { + getABIEncodedTransactionData( + _to: string, + _value: BigNumber, + ): string { assert.isString('_to', _to); assert.isBigNumber('_value', _value); - const self = (this as any) as ERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [ - _to.toLowerCase(), - _value, - ]); + const self = this as any as ERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), + _value + ]); return abiEncodedTransactionData; }, }; @@ -540,7 +575,8 @@ export class ERC20TokenContract extends BaseContract { _spender: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.isString('_spender', _spender); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -551,11 +587,10 @@ export class ERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('allowance(address,address)', [ - _owner.toLowerCase(), - _spender.toLowerCase(), - ]); + const self = this as any as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('allowance(address,address)', [_owner.toLowerCase(), + _spender.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -564,34 +599,36 @@ export class ERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_owner: string, _spender: string): string { + getABIEncodedTransactionData( + _owner: string, + _spender: string, + ): string { assert.isString('_owner', _owner); assert.isString('_spender', _spender); - const self = (this as any) as ERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [ - _owner.toLowerCase(), - _spender.toLowerCase(), - ]); + const self = this as any as ERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [_owner.toLowerCase(), + _spender.toLowerCase() + ]); return abiEncodedTransactionData; }, }; - private readonly _subscriptionManager: SubscriptionManager; - public static async deployFrom0xArtifactAsync( +private readonly _subscriptionManager: SubscriptionManager; +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, + artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -604,13 +641,15 @@ export class ERC20TokenContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - return ERC20TokenContract.deployAsync(bytecode, abi, provider, txDefaults); + const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); + return ERC20TokenContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, ); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, + abiDependencies: { [contractName: string]: ContractAbi }, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -620,13 +659,17 @@ export class ERC20TokenContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); + [] = BaseContract._formatABIDataItemList( + constructorAbi.inputs, + [], + BaseContract._bigNumberToString, + ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -634,17 +677,18 @@ export class ERC20TokenContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`ERC20Token successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ERC20TokenContract(txReceipt.contractAddress as string, provider, txDefaults); + const contractInstance = new ERC20TokenContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); contractInstance.constructorArgs = []; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: false, inputs: [ { @@ -667,9 +711,10 @@ export class ERC20TokenContract extends BaseContract { stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'totalSupply', outputs: [ { @@ -681,7 +726,7 @@ export class ERC20TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -708,7 +753,7 @@ export class ERC20TokenContract extends BaseContract { stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -727,7 +772,7 @@ export class ERC20TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -750,7 +795,7 @@ export class ERC20TokenContract extends BaseContract { stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -773,7 +818,7 @@ export class ERC20TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { anonymous: false, inputs: [ { @@ -793,10 +838,11 @@ export class ERC20TokenContract extends BaseContract { }, ], name: 'Transfer', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -816,7 +862,8 @@ export class ERC20TokenContract extends BaseContract { }, ], name: 'Approval', - outputs: [], + outputs: [ + ], type: 'event', }, ] as ContractAbi; @@ -890,15 +937,15 @@ export class ERC20TokenContract extends BaseContract { ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial) { - super('ERC20Token', ERC20TokenContract.ABI(), address, supportedProvider, txDefaults); + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + super('ERC20Token', ERC20TokenContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( ERC20TokenContract.ABI(), this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 d9f18a654e..ffeb122490 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts @@ -1,14 +1,11 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { - BaseContract, +import { BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager, - PromiseWithTransactionHash, -} from '@0x/base-contract'; + SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -29,6 +26,7 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; +import * as _ from 'lodash'; // tslint:enable:no-unused-variable export type ERC721ProxyEventArgs = @@ -50,30 +48,38 @@ export interface ERC721ProxyAuthorizedAddressRemovedEventArgs extends DecodedLog caller: string; } + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class ERC721ProxyContract extends BaseContract { public addAuthorizedAddress = { - async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.addAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + target: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('target', target); + const self = this as any as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.addAuthorizedAddress.estimateGasAsync.bind( + self, + target.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -81,41 +87,51 @@ export class ERC721ProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = (this as any) as ERC721ProxyContract; - const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + const self = this as any as ERC721ProxyContract; + const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + target: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('target', target); + const self = this as any as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + target: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('target', target); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -125,8 +141,9 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); + const self = this as any as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -135,24 +152,24 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(target: string): string { + getABIEncodedTransactionData( + target: string, + ): string { assert.isString('target', target); - const self = (this as any) as ERC721ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [ - target.toLowerCase(), - ]); + const self = this as any as ERC721ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() + ]); return abiEncodedTransactionData; }, }; @@ -161,7 +178,8 @@ export class ERC721ProxyContract extends BaseContract { index_0: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -171,8 +189,9 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0]); + const self = this as any as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0 + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -181,45 +200,54 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: BigNumber): string { + getABIEncodedTransactionData( + index_0: BigNumber, + ): string { assert.isBigNumber('index_0', index_0); - const self = (this as any) as ERC721ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('authorities(uint256)', [index_0]); + const self = this as any as ERC721ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('authorities(uint256)', [index_0 + ]); return abiEncodedTransactionData; }, }; public removeAuthorizedAddress = { - async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + target: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('target', target); + const self = this as any as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeAuthorizedAddress.estimateGasAsync.bind( + self, + target.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -227,41 +255,51 @@ export class ERC721ProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = (this as any) as ERC721ProxyContract; - const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + const self = this as any as ERC721ProxyContract; + const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + target: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('target', target); + const self = this as any as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + target: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('target', target); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -271,8 +309,9 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); + const self = this as any as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -281,29 +320,33 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(target: string): string { + getABIEncodedTransactionData( + target: string, + ): string { assert.isString('target', target); - const self = (this as any) as ERC721ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [ - target.toLowerCase(), - ]); + const self = this as any as ERC721ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public owner = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -312,7 +355,7 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721ProxyContract; + const self = this as any as ERC721ProxyContract; const encodedData = self._strictEncodeArguments('owner()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -322,20 +365,20 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as ERC721ProxyContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as ERC721ProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); return abiEncodedTransactionData; }, @@ -344,30 +387,33 @@ export class ERC721ProxyContract extends BaseContract { async sendTransactionAsync( target: string, index: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = this as any as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), + index + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind( + self, target.toLowerCase(), - index, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(self, target.toLowerCase(), index), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + index + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -376,59 +422,57 @@ export class ERC721ProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as ERC721ProxyContract; - const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync( - target.toLowerCase(), - index, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = this as any as ERC721ProxyContract; + const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync(target.toLowerCase(), + index + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( target: string, index: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target.toLowerCase(), - index, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = this as any as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), + index + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( target: string, index: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('target', target); assert.isBigNumber('index', index); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -439,11 +483,10 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target.toLowerCase(), - index, - ]); + const self = this as any as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), + index + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -452,31 +495,36 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(target: string, index: BigNumber): string { + getABIEncodedTransactionData( + target: string, + index: BigNumber, + ): string { assert.isString('target', target); assert.isBigNumber('index', index); - const self = (this as any) as ERC721ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'removeAuthorizedAddressAtIndex(address,uint256)', - [target.toLowerCase(), index], - ); + const self = this as any as ERC721ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), + index + ]); return abiEncodedTransactionData; }, }; public getProxyId = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -485,7 +533,7 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721ProxyContract; + const self = this as any as ERC721ProxyContract; const encodedData = self._strictEncodeArguments('getProxyId()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -495,20 +543,20 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getProxyId()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as ERC721ProxyContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as ERC721ProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('getProxyId()', []); return abiEncodedTransactionData; }, @@ -518,7 +566,8 @@ export class ERC721ProxyContract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -528,8 +577,9 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase()]); + const self = this as any as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -538,29 +588,33 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorized(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: string): string { + getABIEncodedTransactionData( + index_0: string, + ): string { assert.isString('index_0', index_0); - const self = (this as any) as ERC721ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [ - index_0.toLowerCase(), - ]); + const self = this as any as ERC721ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public getAuthorizedAddresses = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -569,7 +623,7 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721ProxyContract; + const self = this as any as ERC721ProxyContract; const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -579,44 +633,51 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as ERC721ProxyContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as ERC721ProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('getAuthorizedAddresses()', []); return abiEncodedTransactionData; }, }; public transferOwnership = { - async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + newOwner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('newOwner', newOwner); + const self = this as any as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferOwnership.estimateGasAsync.bind( + self, + newOwner.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( newOwner: string, @@ -624,41 +685,51 @@ export class ERC721ProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('newOwner', newOwner); - const self = (this as any) as ERC721ProxyContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('newOwner', newOwner); + const self = this as any as ERC721ProxyContract; + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + newOwner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('newOwner', newOwner); + const self = this as any as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + newOwner: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -668,8 +739,9 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const self = this as any as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -678,32 +750,33 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(newOwner: string): string { + getABIEncodedTransactionData( + newOwner: string, + ): string { assert.isString('newOwner', newOwner); - const self = (this as any) as ERC721ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ - newOwner.toLowerCase(), - ]); + const self = this as any as ERC721ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); return abiEncodedTransactionData; }, }; - private readonly _subscriptionManager: SubscriptionManager; - public static async deployFrom0xArtifactAsync( +private readonly _subscriptionManager: SubscriptionManager; +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, + artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -716,13 +789,15 @@ export class ERC721ProxyContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - return ERC721ProxyContract.deployAsync(bytecode, abi, provider, txDefaults); + const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); + return ERC721ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, ); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, + abiDependencies: { [contractName: string]: ContractAbi }, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -732,13 +807,17 @@ export class ERC721ProxyContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); + [] = BaseContract._formatABIDataItemList( + constructorAbi.inputs, + [], + BaseContract._bigNumberToString, + ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -746,17 +825,18 @@ export class ERC721ProxyContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`ERC721Proxy successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ERC721ProxyContract(txReceipt.contractAddress as string, provider, txDefaults); + const contractInstance = new ERC721ProxyContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); contractInstance.constructorArgs = []; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: false, inputs: [ { @@ -765,12 +845,13 @@ export class ERC721ProxyContract extends BaseContract { }, ], name: 'addAuthorizedAddress', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -789,7 +870,7 @@ export class ERC721ProxyContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -798,14 +879,16 @@ export class ERC721ProxyContract extends BaseContract { }, ], name: 'removeAuthorizedAddress', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'owner', outputs: [ { @@ -817,7 +900,7 @@ export class ERC721ProxyContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -830,14 +913,16 @@ export class ERC721ProxyContract extends BaseContract { }, ], name: 'removeAuthorizedAddressAtIndex', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'getProxyId', outputs: [ { @@ -849,7 +934,7 @@ export class ERC721ProxyContract extends BaseContract { stateMutability: 'pure', type: 'function', }, - { + { constant: true, inputs: [ { @@ -868,9 +953,10 @@ export class ERC721ProxyContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'getAuthorizedAddresses', outputs: [ { @@ -882,7 +968,7 @@ export class ERC721ProxyContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -891,19 +977,22 @@ export class ERC721ProxyContract extends BaseContract { }, ], name: 'transferOwnership', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { - inputs: [], - outputs: [], + { + inputs: [ + ], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'fallback', }, - { + { anonymous: false, inputs: [ { @@ -918,10 +1007,11 @@ export class ERC721ProxyContract extends BaseContract { }, ], name: 'AuthorizedAddressAdded', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -936,7 +1026,8 @@ export class ERC721ProxyContract extends BaseContract { }, ], name: 'AuthorizedAddressRemoved', - outputs: [], + outputs: [ + ], type: 'event', }, ] as ContractAbi; @@ -1010,15 +1101,15 @@ export class ERC721ProxyContract extends BaseContract { ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial) { - super('ERC721Proxy', ERC721ProxyContract.ABI(), address, supportedProvider, txDefaults); + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + super('ERC721Proxy', ERC721ProxyContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( ERC721ProxyContract.ABI(), this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 00f849aca6..c4b4d2a8c7 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts @@ -1,14 +1,11 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { - BaseContract, +import { BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager, - PromiseWithTransactionHash, -} from '@0x/base-contract'; + SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -29,6 +26,7 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; +import * as _ from 'lodash'; // tslint:enable:no-unused-variable export type ERC721TokenEventArgs = @@ -60,6 +58,7 @@ export interface ERC721TokenApprovalForAllEventArgs extends DecodedLogArgs { _approved: boolean; } + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name @@ -69,7 +68,8 @@ export class ERC721TokenContract extends BaseContract { _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('_tokenId', _tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -79,8 +79,9 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId]); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -89,22 +90,24 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getApproved(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_tokenId: BigNumber): string { + getABIEncodedTransactionData( + _tokenId: BigNumber, + ): string { assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId]); + const self = this as any as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId + ]); return abiEncodedTransactionData; }, }; @@ -112,30 +115,33 @@ export class ERC721TokenContract extends BaseContract { async sendTransactionAsync( _approved: string, _tokenId: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_approved', _approved); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + assert.isString('_approved', _approved); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(), + _tokenId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.approve.estimateGasAsync.bind( + self, _approved.toLowerCase(), - _tokenId, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind(self, _approved.toLowerCase(), _tokenId), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _tokenId + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _approved: string, @@ -144,55 +150,57 @@ export class ERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_approved', _approved); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as ERC721TokenContract; - const txHashPromise = self.approve.sendTransactionAsync(_approved.toLowerCase(), _tokenId, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_approved', _approved); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as ERC721TokenContract; + const txHashPromise = self.approve.sendTransactionAsync(_approved.toLowerCase(), + _tokenId + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _approved: string, _tokenId: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_approved', _approved); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ - _approved.toLowerCase(), - _tokenId, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_approved', _approved); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(), + _tokenId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _approved: string, _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_approved', _approved); assert.isBigNumber('_tokenId', _tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -203,11 +211,10 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ - _approved.toLowerCase(), - _tokenId, - ]); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(), + _tokenId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -216,26 +223,27 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_approved: string, _tokenId: BigNumber): string { + getABIEncodedTransactionData( + _approved: string, + _tokenId: BigNumber, + ): string { assert.isString('_approved', _approved); assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [ - _approved.toLowerCase(), - _tokenId, - ]); + const self = this as any as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(), + _tokenId + ]); return abiEncodedTransactionData; }, }; @@ -244,32 +252,36 @@ export class ERC721TokenContract extends BaseContract { _from: string, _to: string, _tokenId: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferFrom.estimateGasAsync.bind( + self, _from.toLowerCase(), _to.toLowerCase(), - _tokenId, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _tokenId), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _tokenId + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -279,27 +291,25 @@ export class ERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as ERC721TokenContract; - const txHashPromise = self.transferFrom.sendTransactionAsync( - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as ERC721TokenContract; + const txHashPromise = self.transferFrom.sendTransactionAsync(_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -307,29 +317,28 @@ export class ERC721TokenContract extends BaseContract { _tokenId: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -337,7 +346,8 @@ export class ERC721TokenContract extends BaseContract { _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); @@ -349,12 +359,11 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - ]); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -363,28 +372,30 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_from: string, _to: string, _tokenId: BigNumber): string { + getABIEncodedTransactionData( + _from: string, + _to: string, + _tokenId: BigNumber, + ): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - ]); + const self = this as any as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + ]); return abiEncodedTransactionData; }, }; @@ -393,32 +404,36 @@ export class ERC721TokenContract extends BaseContract { _from: string, _to: string, _tokenId: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.safeTransferFrom1.estimateGasAsync.bind( + self, _from.toLowerCase(), _to.toLowerCase(), - _tokenId, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.safeTransferFrom1.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _tokenId), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _tokenId + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -428,27 +443,25 @@ export class ERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as ERC721TokenContract; - const txHashPromise = self.safeTransferFrom1.sendTransactionAsync( - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as ERC721TokenContract; + const txHashPromise = self.safeTransferFrom1.sendTransactionAsync(_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -456,29 +469,28 @@ export class ERC721TokenContract extends BaseContract { _tokenId: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -486,7 +498,8 @@ export class ERC721TokenContract extends BaseContract { _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); @@ -498,12 +511,11 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - ]); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -512,28 +524,30 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_from: string, _to: string, _tokenId: BigNumber): string { + getABIEncodedTransactionData( + _from: string, + _to: string, + _tokenId: BigNumber, + ): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - ]); + const self = this as any as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + ]); return abiEncodedTransactionData; }, }; @@ -542,7 +556,8 @@ export class ERC721TokenContract extends BaseContract { _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('_tokenId', _tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -552,8 +567,9 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId]); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -562,22 +578,24 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('ownerOf(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_tokenId: BigNumber): string { + getABIEncodedTransactionData( + _tokenId: BigNumber, + ): string { assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId]); + const self = this as any as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId + ]); return abiEncodedTransactionData; }, }; @@ -586,7 +604,8 @@ export class ERC721TokenContract extends BaseContract { _owner: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -596,8 +615,9 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -606,22 +626,24 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_owner: string): string { + getABIEncodedTransactionData( + _owner: string, + ): string { assert.isString('_owner', _owner); - const self = (this as any) as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); + const self = this as any as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() + ]); return abiEncodedTransactionData; }, }; @@ -629,30 +651,33 @@ export class ERC721TokenContract extends BaseContract { async sendTransactionAsync( _operator: string, _approved: boolean, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_operator', _operator); - assert.isBoolean('_approved', _approved); - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ + assert.isString('_operator', _operator); + assert.isBoolean('_approved', _approved); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(), + _approved + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.setApprovalForAll.estimateGasAsync.bind( + self, _operator.toLowerCase(), - _approved, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.setApprovalForAll.estimateGasAsync.bind(self, _operator.toLowerCase(), _approved), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _approved + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _operator: string, @@ -661,59 +686,57 @@ export class ERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_operator', _operator); - assert.isBoolean('_approved', _approved); - const self = (this as any) as ERC721TokenContract; - const txHashPromise = self.setApprovalForAll.sendTransactionAsync( - _operator.toLowerCase(), - _approved, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_operator', _operator); + assert.isBoolean('_approved', _approved); + const self = this as any as ERC721TokenContract; + const txHashPromise = self.setApprovalForAll.sendTransactionAsync(_operator.toLowerCase(), + _approved + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _operator: string, _approved: boolean, txData?: Partial | undefined, ): Promise { - assert.isString('_operator', _operator); - assert.isBoolean('_approved', _approved); - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ - _operator.toLowerCase(), - _approved, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_operator', _operator); + assert.isBoolean('_approved', _approved); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(), + _approved + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _operator: string, _approved: boolean, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_operator', _operator); assert.isBoolean('_approved', _approved); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -724,11 +747,10 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ - _operator.toLowerCase(), - _approved, - ]); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(), + _approved + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -737,26 +759,27 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_operator: string, _approved: boolean): string { + getABIEncodedTransactionData( + _operator: string, + _approved: boolean, + ): string { assert.isString('_operator', _operator); assert.isBoolean('_approved', _approved); - const self = (this as any) as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ - _operator.toLowerCase(), - _approved, - ]); + const self = this as any as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(), + _approved + ]); return abiEncodedTransactionData; }, }; @@ -766,40 +789,39 @@ export class ERC721TokenContract extends BaseContract { _to: string, _tokenId: BigNumber, _data: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - assert.isString('_data', _data); - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [ + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + assert.isString('_data', _data); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.safeTransferFrom2.estimateGasAsync.bind( + self, _from.toLowerCase(), _to.toLowerCase(), _tokenId, - _data, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.safeTransferFrom2.estimateGasAsync.bind( - self, - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data, - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _data + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -810,29 +832,27 @@ export class ERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - assert.isString('_data', _data); - const self = (this as any) as ERC721TokenContract; - const txHashPromise = self.safeTransferFrom2.sendTransactionAsync( - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + assert.isString('_data', _data); + const self = this as any as ERC721TokenContract; + const txHashPromise = self.safeTransferFrom2.sendTransactionAsync(_from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -841,31 +861,30 @@ export class ERC721TokenContract extends BaseContract { _data: string, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - assert.isString('_data', _data); - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + assert.isString('_data', _data); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -874,7 +893,8 @@ export class ERC721TokenContract extends BaseContract { _data: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); @@ -887,13 +907,12 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data, - ]); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -902,28 +921,33 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_from: string, _to: string, _tokenId: BigNumber, _data: string): string { + getABIEncodedTransactionData( + _from: string, + _to: string, + _tokenId: BigNumber, + _data: string, + ): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); assert.isString('_data', _data); - const self = (this as any) as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'safeTransferFrom(address,address,uint256,bytes)', - [_from.toLowerCase(), _to.toLowerCase(), _tokenId, _data], - ); + const self = this as any as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data + ]); return abiEncodedTransactionData; }, }; @@ -933,7 +957,8 @@ export class ERC721TokenContract extends BaseContract { _operator: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.isString('_operator', _operator); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -944,11 +969,10 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('isApprovedForAll(address,address)', [ - _owner.toLowerCase(), - _operator.toLowerCase(), - ]); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('isApprovedForAll(address,address)', [_owner.toLowerCase(), + _operator.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -957,34 +981,36 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isApprovedForAll(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_owner: string, _operator: string): string { + getABIEncodedTransactionData( + _owner: string, + _operator: string, + ): string { assert.isString('_owner', _owner); assert.isString('_operator', _operator); - const self = (this as any) as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('isApprovedForAll(address,address)', [ - _owner.toLowerCase(), - _operator.toLowerCase(), - ]); + const self = this as any as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isApprovedForAll(address,address)', [_owner.toLowerCase(), + _operator.toLowerCase() + ]); return abiEncodedTransactionData; }, }; - private readonly _subscriptionManager: SubscriptionManager; - public static async deployFrom0xArtifactAsync( +private readonly _subscriptionManager: SubscriptionManager; +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, + artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -997,13 +1023,15 @@ export class ERC721TokenContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - return ERC721TokenContract.deployAsync(bytecode, abi, provider, txDefaults); + const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); + return ERC721TokenContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, ); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, + abiDependencies: { [contractName: string]: ContractAbi }, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -1013,13 +1041,17 @@ export class ERC721TokenContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); + [] = BaseContract._formatABIDataItemList( + constructorAbi.inputs, + [], + BaseContract._bigNumberToString, + ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -1027,17 +1059,18 @@ export class ERC721TokenContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`ERC721Token successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ERC721TokenContract(txReceipt.contractAddress as string, provider, txDefaults); + const contractInstance = new ERC721TokenContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); contractInstance.constructorArgs = []; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -1056,7 +1089,7 @@ export class ERC721TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1069,12 +1102,13 @@ export class ERC721TokenContract extends BaseContract { }, ], name: 'approve', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1091,12 +1125,13 @@ export class ERC721TokenContract extends BaseContract { }, ], name: 'transferFrom', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1113,12 +1148,13 @@ export class ERC721TokenContract extends BaseContract { }, ], name: 'safeTransferFrom', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1137,7 +1173,7 @@ export class ERC721TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1156,7 +1192,7 @@ export class ERC721TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1169,12 +1205,13 @@ export class ERC721TokenContract extends BaseContract { }, ], name: 'setApprovalForAll', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1195,12 +1232,13 @@ export class ERC721TokenContract extends BaseContract { }, ], name: 'safeTransferFrom', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1223,7 +1261,7 @@ export class ERC721TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { anonymous: false, inputs: [ { @@ -1243,10 +1281,11 @@ export class ERC721TokenContract extends BaseContract { }, ], name: 'Transfer', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1266,10 +1305,11 @@ export class ERC721TokenContract extends BaseContract { }, ], name: 'Approval', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1289,7 +1329,8 @@ export class ERC721TokenContract extends BaseContract { }, ], name: 'ApprovalForAll', - outputs: [], + outputs: [ + ], type: 'event', }, ] as ContractAbi; @@ -1363,15 +1404,15 @@ export class ERC721TokenContract extends BaseContract { ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial) { - super('ERC721Token', ERC721TokenContract.ABI(), address, supportedProvider, txDefaults); + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + super('ERC721Token', ERC721TokenContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( ERC721TokenContract.ABI(), this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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..a6eecd9aad 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 @@ -1,7 +1,7 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract'; +import { BaseContract,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -21,8 +21,10 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; +import * as _ from 'lodash'; // tslint:enable:no-unused-variable + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name @@ -32,7 +34,8 @@ export class EthBalanceCheckerContract extends BaseContract { addresses: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isArray('addresses', addresses); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -42,8 +45,9 @@ export class EthBalanceCheckerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as EthBalanceCheckerContract; - const encodedData = self._strictEncodeArguments('getEthBalances(address[])', [addresses]); + const self = this as any as EthBalanceCheckerContract; + const encodedData = self._strictEncodeArguments('getEthBalances(address[])', [addresses + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -52,29 +56,32 @@ export class EthBalanceCheckerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getEthBalances(address[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(addresses: string[]): string { + getABIEncodedTransactionData( + addresses: string[], + ): string { assert.isArray('addresses', addresses); - const self = (this as any) as EthBalanceCheckerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getEthBalances(address[])', [addresses]); + const self = this as any as EthBalanceCheckerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getEthBalances(address[])', [addresses + ]); return abiEncodedTransactionData; }, }; - public static async deployFrom0xArtifactAsync( +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, + artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -87,13 +94,15 @@ export class EthBalanceCheckerContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - return EthBalanceCheckerContract.deployAsync(bytecode, abi, provider, txDefaults); + const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); + return EthBalanceCheckerContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, ); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, + abiDependencies: { [contractName: string]: ContractAbi }, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -103,13 +112,17 @@ export class EthBalanceCheckerContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); + [] = BaseContract._formatABIDataItemList( + constructorAbi.inputs, + [], + BaseContract._bigNumberToString, + ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -117,21 +130,18 @@ export class EthBalanceCheckerContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`EthBalanceChecker successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new EthBalanceCheckerContract( - txReceipt.contractAddress as string, - provider, - txDefaults, - ); + const contractInstance = new EthBalanceCheckerContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); contractInstance.constructorArgs = []; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -153,11 +163,11 @@ export class EthBalanceCheckerContract extends BaseContract { ] as ContractAbi; return abi; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial) { - super('EthBalanceChecker', EthBalanceCheckerContract.ABI(), address, supportedProvider, txDefaults); + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + super('EthBalanceChecker', EthBalanceCheckerContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts index 0cdd34e277..2b78ee980a 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts @@ -1,14 +1,11 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { - BaseContract, +import { BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager, - PromiseWithTransactionHash, -} from '@0x/base-contract'; + SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -29,6 +26,7 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; +import * as _ from 'lodash'; // tslint:enable:no-unused-variable export type ExchangeEventArgs = @@ -86,6 +84,7 @@ export interface ExchangeAssetProxyRegisteredEventArgs extends DecodedLogArgs { assetProxy: string; } + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name @@ -95,7 +94,8 @@ export class ExchangeContract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -105,8 +105,9 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('filled(bytes32)', [index_0]); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('filled(bytes32)', [index_0 + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -115,179 +116,128 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('filled(bytes32)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: string): string { + getABIEncodedTransactionData( + index_0: string, + ): string { assert.isString('index_0', index_0); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('filled(bytes32)', [index_0]); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('filled(bytes32)', [index_0 + ]); return abiEncodedTransactionData; }, }; public batchFillOrders = { async sendTransactionAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmounts: BigNumber[], signatures: string[], - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', - [orders, takerAssetFillAmounts, signatures], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.batchFillOrders.estimateGasAsync.bind(self, orders, takerAssetFillAmounts, signatures), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, + takerAssetFillAmounts, + signatures + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.batchFillOrders.estimateGasAsync.bind( + self, + orders, + takerAssetFillAmounts, + signatures + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmounts: BigNumber[], signatures: string[], txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.batchFillOrders.sendTransactionAsync( - orders, - takerAssetFillAmounts, - signatures, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const txHashPromise = self.batchFillOrders.sendTransactionAsync(orders, + takerAssetFillAmounts, + signatures + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmounts: BigNumber[], signatures: string[], txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', - [orders, takerAssetFillAmounts, signatures], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, + takerAssetFillAmounts, + signatures + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmounts: BigNumber[], signatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }> { + ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + > { assert.isArray('orders', orders); assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); assert.isArray('signatures', signatures); @@ -299,11 +249,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', - [orders, takerAssetFillAmounts, signatures], - ); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, + takerAssetFillAmounts, + signatures + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -312,51 +262,30 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', - ); + const abiEncoder = self._lookupAbiEncoder('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - ): string { + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + takerAssetFillAmounts: BigNumber[], + signatures: string[], + ): string { assert.isArray('orders', orders); assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', - [orders, takerAssetFillAmounts, signatures], - ); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, + takerAssetFillAmounts, + signatures + ]); return abiEncodedTransactionData; }, }; @@ -365,7 +294,8 @@ export class ExchangeContract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -375,8 +305,9 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('cancelled(bytes32)', [index_0]); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('cancelled(bytes32)', [index_0 + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -385,22 +316,24 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('cancelled(bytes32)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: string): string { + getABIEncodedTransactionData( + index_0: string, + ): string { assert.isString('index_0', index_0); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('cancelled(bytes32)', [index_0]); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('cancelled(bytes32)', [index_0 + ]); return abiEncodedTransactionData; }, }; @@ -409,32 +342,36 @@ export class ExchangeContract extends BaseContract { hash: string, signerAddress: string, signature: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('hash', hash); - assert.isString('signerAddress', signerAddress); - assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [ + assert.isString('hash', hash); + assert.isString('signerAddress', signerAddress); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [hash, + signerAddress.toLowerCase(), + signature + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.preSign.estimateGasAsync.bind( + self, hash, signerAddress.toLowerCase(), - signature, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.preSign.estimateGasAsync.bind(self, hash, signerAddress.toLowerCase(), signature), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + signature + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( hash: string, @@ -444,27 +381,25 @@ export class ExchangeContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('hash', hash); - assert.isString('signerAddress', signerAddress); - assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.preSign.sendTransactionAsync( - hash, - signerAddress.toLowerCase(), - signature, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('hash', hash); + assert.isString('signerAddress', signerAddress); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const txHashPromise = self.preSign.sendTransactionAsync(hash, + signerAddress.toLowerCase(), + signature + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( hash: string, @@ -472,29 +407,28 @@ export class ExchangeContract extends BaseContract { signature: string, txData?: Partial | undefined, ): Promise { - assert.isString('hash', hash); - assert.isString('signerAddress', signerAddress); - assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [ - hash, - signerAddress.toLowerCase(), - signature, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('hash', hash); + assert.isString('signerAddress', signerAddress); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [hash, + signerAddress.toLowerCase(), + signature + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( hash: string, @@ -502,7 +436,8 @@ export class ExchangeContract extends BaseContract { signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('hash', hash); assert.isString('signerAddress', signerAddress); assert.isString('signature', signature); @@ -514,12 +449,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [ - hash, - signerAddress.toLowerCase(), - signature, - ]); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [hash, + signerAddress.toLowerCase(), + signature + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -528,248 +462,147 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('preSign(bytes32,address,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(hash: string, signerAddress: string, signature: string): string { + getABIEncodedTransactionData( + hash: string, + signerAddress: string, + signature: string, + ): string { assert.isString('hash', hash); assert.isString('signerAddress', signerAddress); assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [ - hash, - signerAddress.toLowerCase(), - signature, - ]); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [hash, + signerAddress.toLowerCase(), + signature + ]); return abiEncodedTransactionData; }, }; public matchOrders = { async sendTransactionAsync( - leftOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - rightOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, leftSignature: string, rightSignature: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('leftSignature', leftSignature); - assert.isString('rightSignature', rightSignature); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', - [leftOrder, rightOrder, leftSignature, rightSignature], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.matchOrders.estimateGasAsync.bind(self, leftOrder, rightOrder, leftSignature, rightSignature), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + + + assert.isString('leftSignature', leftSignature); + assert.isString('rightSignature', rightSignature); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [leftOrder, + rightOrder, + leftSignature, + rightSignature + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.matchOrders.estimateGasAsync.bind( + self, + leftOrder, + rightOrder, + leftSignature, + rightSignature + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - leftOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - rightOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, leftSignature: string, rightSignature: string, txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('leftSignature', leftSignature); - assert.isString('rightSignature', rightSignature); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.matchOrders.sendTransactionAsync( - leftOrder, - rightOrder, - leftSignature, - rightSignature, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + + + assert.isString('leftSignature', leftSignature); + assert.isString('rightSignature', rightSignature); + const self = this as any as ExchangeContract; + const txHashPromise = self.matchOrders.sendTransactionAsync(leftOrder, + rightOrder, + leftSignature, + rightSignature + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - leftOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - rightOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, leftSignature: string, rightSignature: string, txData?: Partial | undefined, ): Promise { - assert.isString('leftSignature', leftSignature); - assert.isString('rightSignature', rightSignature); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', - [leftOrder, rightOrder, leftSignature, rightSignature], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + + + assert.isString('leftSignature', leftSignature); + assert.isString('rightSignature', rightSignature); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [leftOrder, + rightOrder, + leftSignature, + rightSignature + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - leftOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - rightOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, leftSignature: string, rightSignature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{ - left: { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }; - right: { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }; - leftMakerAssetSpreadAmount: BigNumber; - }> { + ): Promise<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber} + > { + + assert.isString('leftSignature', leftSignature); assert.isString('rightSignature', rightSignature); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -780,11 +613,12 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', - [leftOrder, rightOrder, leftSignature, rightSignature], - ); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [leftOrder, + rightOrder, + leftSignature, + rightSignature + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -793,227 +627,138 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(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)', - ); + const abiEncoder = self._lookupAbiEncoder('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ - left: { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }; - right: { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }; - leftMakerAssetSpreadAmount: BigNumber; - }>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber} + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - leftOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - rightOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - leftSignature: string, - rightSignature: string, - ): string { + leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + leftSignature: string, + rightSignature: string, + ): string { + + assert.isString('leftSignature', leftSignature); assert.isString('rightSignature', rightSignature); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', - [leftOrder, rightOrder, leftSignature, rightSignature], - ); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [leftOrder, + rightOrder, + leftSignature, + rightSignature + ]); return abiEncodedTransactionData; }, }; public fillOrderNoThrow = { async sendTransactionAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, takerAssetFillAmount: BigNumber, signature: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', - [order, takerAssetFillAmount, signature], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.fillOrderNoThrow.estimateGasAsync.bind(self, order, takerAssetFillAmount, signature), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, + takerAssetFillAmount, + signature + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.fillOrderNoThrow.estimateGasAsync.bind( + self, + order, + takerAssetFillAmount, + signature + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, takerAssetFillAmount: BigNumber, signature: string, txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.fillOrderNoThrow.sendTransactionAsync( - order, - takerAssetFillAmount, - signature, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const txHashPromise = self.fillOrderNoThrow.sendTransactionAsync(order, + takerAssetFillAmount, + signature + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, takerAssetFillAmount: BigNumber, signature: string, txData?: Partial | undefined, ): Promise { - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', - [order, takerAssetFillAmount, signature], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, + takerAssetFillAmount, + signature + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, takerAssetFillAmount: BigNumber, signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }> { + ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + > { + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -1024,11 +769,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', - [order, takerAssetFillAmount, signature], - ); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, + takerAssetFillAmount, + signature + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1037,55 +782,40 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', - ); + const abiEncoder = self._lookupAbiEncoder('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - takerAssetFillAmount: BigNumber, - signature: string, - ): string { + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + takerAssetFillAmount: BigNumber, + signature: string, + ): string { + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', - [order, takerAssetFillAmount, signature], - ); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, + takerAssetFillAmount, + signature + ]); return abiEncodedTransactionData; }, }; public assetProxies = { - async callAsync(index_0: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + index_0: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1095,8 +825,9 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0]); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0 + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1105,155 +836,106 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('assetProxies(bytes4)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: string): string { + getABIEncodedTransactionData( + index_0: string, + ): string { assert.isString('index_0', index_0); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0]); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0 + ]); return abiEncodedTransactionData; }, }; public batchCancelOrders = { async sendTransactionAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, - txData?: Partial | undefined, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', - [orders], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.batchCancelOrders.estimateGasAsync.bind(self, orders), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - awaitTransactionSuccessAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + assert.isArray('orders', orders); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.batchCancelOrders.estimateGasAsync.bind( + self, + orders + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + awaitTransactionSuccessAsync( + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.batchCancelOrders.sendTransactionAsync(orders, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + const self = this as any as ExchangeContract; + const txHashPromise = self.batchCancelOrders.sendTransactionAsync(orders + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', - [orders], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isArray('orders', orders); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1263,11 +945,9 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', - [orders], - ); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1276,199 +956,128 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', - ); + const abiEncoder = self._lookupAbiEncoder('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, - ): string { + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + ): string { assert.isArray('orders', orders); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', - [orders], - ); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders + ]); return abiEncodedTransactionData; }, }; public batchFillOrKillOrders = { async sendTransactionAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmounts: BigNumber[], signatures: string[], - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', - [orders, takerAssetFillAmounts, signatures], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.batchFillOrKillOrders.estimateGasAsync.bind(self, orders, takerAssetFillAmounts, signatures), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, + takerAssetFillAmounts, + signatures + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.batchFillOrKillOrders.estimateGasAsync.bind( + self, + orders, + takerAssetFillAmounts, + signatures + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmounts: BigNumber[], signatures: string[], txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.batchFillOrKillOrders.sendTransactionAsync( - orders, - takerAssetFillAmounts, - signatures, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const txHashPromise = self.batchFillOrKillOrders.sendTransactionAsync(orders, + takerAssetFillAmounts, + signatures + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmounts: BigNumber[], signatures: string[], txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', - [orders, takerAssetFillAmounts, signatures], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, + takerAssetFillAmounts, + signatures + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmounts: BigNumber[], signatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }> { + ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + > { assert.isArray('orders', orders); assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); assert.isArray('signatures', signatures); @@ -1480,11 +1089,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', - [orders, takerAssetFillAmounts, signatures], - ); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, + takerAssetFillAmounts, + signatures + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1493,74 +1102,60 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', - ); + const abiEncoder = self._lookupAbiEncoder('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - ): string { + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + takerAssetFillAmounts: BigNumber[], + signatures: string[], + ): string { assert.isArray('orders', orders); assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', - [orders, takerAssetFillAmounts, signatures], - ); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, + takerAssetFillAmounts, + signatures + ]); return abiEncodedTransactionData; }, }; public cancelOrdersUpTo = { - async sendTransactionAsync(targetOrderEpoch: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.cancelOrdersUpTo.estimateGasAsync.bind(self, targetOrderEpoch), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + targetOrderEpoch: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.cancelOrdersUpTo.estimateGasAsync.bind( + self, + targetOrderEpoch + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( targetOrderEpoch: BigNumber, @@ -1568,45 +1163,51 @@ export class ExchangeContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.cancelOrdersUpTo.sendTransactionAsync(targetOrderEpoch, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); + const self = this as any as ExchangeContract; + const txHashPromise = self.cancelOrdersUpTo.sendTransactionAsync(targetOrderEpoch + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(targetOrderEpoch: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + targetOrderEpoch: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( targetOrderEpoch: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1616,8 +1217,9 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch]); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1626,181 +1228,128 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('cancelOrdersUpTo(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(targetOrderEpoch: BigNumber): string { + getABIEncodedTransactionData( + targetOrderEpoch: BigNumber, + ): string { assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [ - targetOrderEpoch, - ]); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch + ]); return abiEncodedTransactionData; }, }; public batchFillOrdersNoThrow = { async sendTransactionAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmounts: BigNumber[], signatures: string[], - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', - [orders, takerAssetFillAmounts, signatures], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.batchFillOrdersNoThrow.estimateGasAsync.bind(self, orders, takerAssetFillAmounts, signatures), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, + takerAssetFillAmounts, + signatures + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.batchFillOrdersNoThrow.estimateGasAsync.bind( + self, + orders, + takerAssetFillAmounts, + signatures + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmounts: BigNumber[], signatures: string[], txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.batchFillOrdersNoThrow.sendTransactionAsync( - orders, - takerAssetFillAmounts, - signatures, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const txHashPromise = self.batchFillOrdersNoThrow.sendTransactionAsync(orders, + takerAssetFillAmounts, + signatures + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmounts: BigNumber[], signatures: string[], txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', - [orders, takerAssetFillAmounts, signatures], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, + takerAssetFillAmounts, + signatures + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmounts: BigNumber[], signatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }> { + ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + > { assert.isArray('orders', orders); assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); assert.isArray('signatures', signatures); @@ -1812,11 +1361,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', - [orders, takerAssetFillAmounts, signatures], - ); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, + takerAssetFillAmounts, + signatures + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1825,51 +1374,30 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', - ); + const abiEncoder = self._lookupAbiEncoder('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - ): string { + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + takerAssetFillAmounts: BigNumber[], + signatures: string[], + ): string { assert.isArray('orders', orders); assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', - [orders, takerAssetFillAmounts, signatures], - ); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, + takerAssetFillAmounts, + signatures + ]); return abiEncodedTransactionData; }, }; @@ -1878,7 +1406,8 @@ export class ExchangeContract extends BaseContract { assetProxyId: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('assetProxyId', assetProxyId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1888,8 +1417,9 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId]); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1898,22 +1428,24 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAssetProxy(bytes4)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(assetProxyId: string): string { + getABIEncodedTransactionData( + assetProxyId: string, + ): string { assert.isString('assetProxyId', assetProxyId); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId]); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId + ]); return abiEncodedTransactionData; }, }; @@ -1922,7 +1454,8 @@ export class ExchangeContract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1932,8 +1465,9 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('transactions(bytes32)', [index_0]); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('transactions(bytes32)', [index_0 + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1942,176 +1476,129 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transactions(bytes32)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: string): string { + getABIEncodedTransactionData( + index_0: string, + ): string { assert.isString('index_0', index_0); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transactions(bytes32)', [index_0]); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transactions(bytes32)', [index_0 + ]); return abiEncodedTransactionData; }, }; public fillOrKillOrder = { async sendTransactionAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, takerAssetFillAmount: BigNumber, signature: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', - [order, takerAssetFillAmount, signature], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.fillOrKillOrder.estimateGasAsync.bind(self, order, takerAssetFillAmount, signature), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, + takerAssetFillAmount, + signature + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.fillOrKillOrder.estimateGasAsync.bind( + self, + order, + takerAssetFillAmount, + signature + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, takerAssetFillAmount: BigNumber, signature: string, txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.fillOrKillOrder.sendTransactionAsync( - order, - takerAssetFillAmount, - signature, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const txHashPromise = self.fillOrKillOrder.sendTransactionAsync(order, + takerAssetFillAmount, + signature + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, takerAssetFillAmount: BigNumber, signature: string, txData?: Partial | undefined, ): Promise { - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', - [order, takerAssetFillAmount, signature], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, + takerAssetFillAmount, + signature + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, takerAssetFillAmount: BigNumber, signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }> { + ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + > { + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -2122,11 +1609,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', - [order, takerAssetFillAmount, signature], - ); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, + takerAssetFillAmount, + signature + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2135,50 +1622,30 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', - ); + const abiEncoder = self._lookupAbiEncoder('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - takerAssetFillAmount: BigNumber, - signature: string, - ): string { + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + takerAssetFillAmount: BigNumber, + signature: string, + ): string { + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', - [order, takerAssetFillAmount, signature], - ); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, + takerAssetFillAmount, + signature + ]); return abiEncodedTransactionData; }, }; @@ -2186,34 +1653,33 @@ export class ExchangeContract extends BaseContract { async sendTransactionAsync( validatorAddress: string, approval: boolean, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('validatorAddress', validatorAddress); - assert.isBoolean('approval', approval); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [ + assert.isString('validatorAddress', validatorAddress); + assert.isBoolean('approval', approval); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [validatorAddress.toLowerCase(), + approval + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.setSignatureValidatorApproval.estimateGasAsync.bind( + self, validatorAddress.toLowerCase(), - approval, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.setSignatureValidatorApproval.estimateGasAsync.bind( - self, - validatorAddress.toLowerCase(), - approval, - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + approval + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( validatorAddress: string, @@ -2222,59 +1688,57 @@ export class ExchangeContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('validatorAddress', validatorAddress); - assert.isBoolean('approval', approval); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.setSignatureValidatorApproval.sendTransactionAsync( - validatorAddress.toLowerCase(), - approval, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('validatorAddress', validatorAddress); + assert.isBoolean('approval', approval); + const self = this as any as ExchangeContract; + const txHashPromise = self.setSignatureValidatorApproval.sendTransactionAsync(validatorAddress.toLowerCase(), + approval + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( validatorAddress: string, approval: boolean, txData?: Partial | undefined, ): Promise { - assert.isString('validatorAddress', validatorAddress); - assert.isBoolean('approval', approval); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [ - validatorAddress.toLowerCase(), - approval, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('validatorAddress', validatorAddress); + assert.isBoolean('approval', approval); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [validatorAddress.toLowerCase(), + approval + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( validatorAddress: string, approval: boolean, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('validatorAddress', validatorAddress); assert.isBoolean('approval', approval); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -2285,11 +1749,10 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [ - validatorAddress.toLowerCase(), - approval, - ]); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [validatorAddress.toLowerCase(), + approval + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2298,26 +1761,27 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('setSignatureValidatorApproval(address,bool)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(validatorAddress: string, approval: boolean): string { + getABIEncodedTransactionData( + validatorAddress: string, + approval: boolean, + ): string { assert.isString('validatorAddress', validatorAddress); assert.isBoolean('approval', approval); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'setSignatureValidatorApproval(address,bool)', - [validatorAddress.toLowerCase(), approval], - ); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [validatorAddress.toLowerCase(), + approval + ]); return abiEncodedTransactionData; }, }; @@ -2327,7 +1791,8 @@ export class ExchangeContract extends BaseContract { index_1: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.isString('index_1', index_1); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -2338,11 +1803,10 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('allowedValidators(address,address)', [ - index_0.toLowerCase(), - index_1.toLowerCase(), - ]); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('allowedValidators(address,address)', [index_0.toLowerCase(), + index_1.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2351,183 +1815,131 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('allowedValidators(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: string, index_1: string): string { + getABIEncodedTransactionData( + index_0: string, + index_1: string, + ): string { assert.isString('index_0', index_0); assert.isString('index_1', index_1); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('allowedValidators(address,address)', [ - index_0.toLowerCase(), - index_1.toLowerCase(), - ]); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('allowedValidators(address,address)', [index_0.toLowerCase(), + index_1.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public marketSellOrders = { async sendTransactionAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmount: BigNumber, signatures: string[], - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - [orders, takerAssetFillAmount, signatures], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.marketSellOrders.estimateGasAsync.bind(self, orders, takerAssetFillAmount, signatures), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isArray('orders', orders); + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + takerAssetFillAmount, + signatures + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.marketSellOrders.estimateGasAsync.bind( + self, + orders, + takerAssetFillAmount, + signatures + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.marketSellOrders.sendTransactionAsync( - orders, - takerAssetFillAmount, - signatures, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const txHashPromise = self.marketSellOrders.sendTransactionAsync(orders, + takerAssetFillAmount, + signatures + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - [orders, takerAssetFillAmount, signatures], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + takerAssetFillAmount, + signatures + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmount: BigNumber, signatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }> { + ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + > { assert.isArray('orders', orders); assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isArray('signatures', signatures); @@ -2539,11 +1951,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - [orders, takerAssetFillAmount, signatures], - ); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + takerAssetFillAmount, + signatures + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2552,73 +1964,40 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - ); + const abiEncoder = self._lookupAbiEncoder('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, - takerAssetFillAmount: BigNumber, - signatures: string[], - ): string { + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + takerAssetFillAmount: BigNumber, + signatures: string[], + ): string { assert.isArray('orders', orders); assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - [orders, takerAssetFillAmount, signatures], - ); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + takerAssetFillAmount, + signatures + ]); return abiEncodedTransactionData; }, }; public getOrdersInfo = { async callAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise> { + ): Promise + > { assert.isArray('orders', orders); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -2628,11 +2007,9 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', - [orders], - ); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2641,44 +2018,24 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', - ); + const abiEncoder = self._lookupAbiEncoder('getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue< - Array<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }> - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, - ): string { + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + ): string { assert.isArray('orders', orders); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', - [orders], - ); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders + ]); return abiEncodedTransactionData; }, }; @@ -2688,7 +2045,8 @@ export class ExchangeContract extends BaseContract { index_1: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.isString('index_1', index_1); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -2699,11 +2057,10 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('preSigned(bytes32,address)', [ - index_0, - index_1.toLowerCase(), - ]); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('preSigned(bytes32,address)', [index_0, + index_1.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2712,31 +2069,36 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('preSigned(bytes32,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: string, index_1: string): string { + getABIEncodedTransactionData( + index_0: string, + index_1: string, + ): string { assert.isString('index_0', index_0); assert.isString('index_1', index_1); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('preSigned(bytes32,address)', [ - index_0, - index_1.toLowerCase(), - ]); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('preSigned(bytes32,address)', [index_0, + index_1.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public owner = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -2745,7 +2107,7 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; + const self = this as any as ExchangeContract; const encodedData = self._strictEncodeArguments('owner()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -2755,20 +2117,20 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as ExchangeContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as ExchangeContract; const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); return abiEncodedTransactionData; }, @@ -2780,7 +2142,8 @@ export class ExchangeContract extends BaseContract { signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('hash', hash); assert.isString('signerAddress', signerAddress); assert.isString('signature', signature); @@ -2792,12 +2155,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [ - hash, - signerAddress.toLowerCase(), - signature, - ]); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [hash, + signerAddress.toLowerCase(), + signature + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2806,185 +2168,134 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isValidSignature(bytes32,address,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(hash: string, signerAddress: string, signature: string): string { + getABIEncodedTransactionData( + hash: string, + signerAddress: string, + signature: string, + ): string { assert.isString('hash', hash); assert.isString('signerAddress', signerAddress); assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [ - hash, - signerAddress.toLowerCase(), - signature, - ]); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [hash, + signerAddress.toLowerCase(), + signature + ]); return abiEncodedTransactionData; }, }; public marketBuyOrdersNoThrow = { async sendTransactionAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, makerAssetFillAmount: BigNumber, signatures: string[], - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - [orders, makerAssetFillAmount, signatures], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.marketBuyOrdersNoThrow.estimateGasAsync.bind(self, orders, makerAssetFillAmount, signatures), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + makerAssetFillAmount, + signatures + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.marketBuyOrdersNoThrow.estimateGasAsync.bind( + self, + orders, + makerAssetFillAmount, + signatures + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, makerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.marketBuyOrdersNoThrow.sendTransactionAsync( - orders, - makerAssetFillAmount, - signatures, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const txHashPromise = self.marketBuyOrdersNoThrow.sendTransactionAsync(orders, + makerAssetFillAmount, + signatures + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, makerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - [orders, makerAssetFillAmount, signatures], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + makerAssetFillAmount, + signatures + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, makerAssetFillAmount: BigNumber, signatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }> { + ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + > { assert.isArray('orders', orders); assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); assert.isArray('signatures', signatures); @@ -2996,11 +2307,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - [orders, makerAssetFillAmount, signatures], - ); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + makerAssetFillAmount, + signatures + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -3009,200 +2320,135 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - ); + const abiEncoder = self._lookupAbiEncoder('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, - makerAssetFillAmount: BigNumber, - signatures: string[], - ): string { + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + makerAssetFillAmount: BigNumber, + signatures: string[], + ): string { assert.isArray('orders', orders); assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - [orders, makerAssetFillAmount, signatures], - ); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + makerAssetFillAmount, + signatures + ]); return abiEncodedTransactionData; }, }; public fillOrder = { async sendTransactionAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, takerAssetFillAmount: BigNumber, signature: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', - [order, takerAssetFillAmount, signature], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.fillOrder.estimateGasAsync.bind(self, order, takerAssetFillAmount, signature), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, + takerAssetFillAmount, + signature + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.fillOrder.estimateGasAsync.bind( + self, + order, + takerAssetFillAmount, + signature + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, takerAssetFillAmount: BigNumber, signature: string, txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.fillOrder.sendTransactionAsync(order, takerAssetFillAmount, signature, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const txHashPromise = self.fillOrder.sendTransactionAsync(order, + takerAssetFillAmount, + signature + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, takerAssetFillAmount: BigNumber, signature: string, txData?: Partial | undefined, ): Promise { - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', - [order, takerAssetFillAmount, signature], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, + takerAssetFillAmount, + signature + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, takerAssetFillAmount: BigNumber, signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }> { + ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + > { + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -3213,11 +2459,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', - [order, takerAssetFillAmount, signature], - ); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, + takerAssetFillAmount, + signature + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -3226,50 +2472,30 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', - ); + const abiEncoder = self._lookupAbiEncoder('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - takerAssetFillAmount: BigNumber, - signature: string, - ): string { + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + takerAssetFillAmount: BigNumber, + signature: string, + ): string { + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', - [order, takerAssetFillAmount, signature], - ); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, + takerAssetFillAmount, + signature + ]); return abiEncodedTransactionData; }, }; @@ -3279,34 +2505,39 @@ export class ExchangeContract extends BaseContract { signerAddress: string, data: string, signature: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isBigNumber('salt', salt); - assert.isString('signerAddress', signerAddress); - assert.isString('data', data); - assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [ + assert.isBigNumber('salt', salt); + assert.isString('signerAddress', signerAddress); + assert.isString('data', data); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [salt, + signerAddress.toLowerCase(), + data, + signature + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.executeTransaction.estimateGasAsync.bind( + self, salt, signerAddress.toLowerCase(), data, - signature, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.executeTransaction.estimateGasAsync.bind(self, salt, signerAddress.toLowerCase(), data, signature), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + signature + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( salt: BigNumber, @@ -3317,29 +2548,27 @@ export class ExchangeContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('salt', salt); - assert.isString('signerAddress', signerAddress); - assert.isString('data', data); - assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.executeTransaction.sendTransactionAsync( - salt, - signerAddress.toLowerCase(), - data, - signature, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('salt', salt); + assert.isString('signerAddress', signerAddress); + assert.isString('data', data); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const txHashPromise = self.executeTransaction.sendTransactionAsync(salt, + signerAddress.toLowerCase(), + data, + signature + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( salt: BigNumber, @@ -3348,31 +2577,30 @@ export class ExchangeContract extends BaseContract { signature: string, txData?: Partial | undefined, ): Promise { - assert.isBigNumber('salt', salt); - assert.isString('signerAddress', signerAddress); - assert.isString('data', data); - assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [ - salt, - signerAddress.toLowerCase(), - data, - signature, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isBigNumber('salt', salt); + assert.isString('signerAddress', signerAddress); + assert.isString('data', data); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [salt, + signerAddress.toLowerCase(), + data, + signature + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( salt: BigNumber, @@ -3381,7 +2609,8 @@ export class ExchangeContract extends BaseContract { signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('salt', salt); assert.isString('signerAddress', signerAddress); assert.isString('data', data); @@ -3394,13 +2623,12 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [ - salt, - signerAddress.toLowerCase(), - data, - signature, - ]); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [salt, + signerAddress.toLowerCase(), + data, + signature + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -3409,51 +2637,63 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('executeTransaction(uint256,address,bytes,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(salt: BigNumber, signerAddress: string, data: string, signature: string): string { + getABIEncodedTransactionData( + salt: BigNumber, + signerAddress: string, + data: string, + signature: string, + ): string { assert.isBigNumber('salt', salt); assert.isString('signerAddress', signerAddress); assert.isString('data', data); assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'executeTransaction(uint256,address,bytes,bytes)', - [salt, signerAddress.toLowerCase(), data, signature], - ); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [salt, + signerAddress.toLowerCase(), + data, + signature + ]); return abiEncodedTransactionData; }, }; public registerAssetProxy = { - async sendTransactionAsync(assetProxy: string, txData?: Partial | undefined): Promise { - assert.isString('assetProxy', assetProxy); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.registerAssetProxy.estimateGasAsync.bind(self, assetProxy.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + assetProxy: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('assetProxy', assetProxy); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.registerAssetProxy.estimateGasAsync.bind( + self, + assetProxy.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( assetProxy: string, @@ -3461,45 +2701,51 @@ export class ExchangeContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('assetProxy', assetProxy); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.registerAssetProxy.sendTransactionAsync(assetProxy.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('assetProxy', assetProxy); + const self = this as any as ExchangeContract; + const txHashPromise = self.registerAssetProxy.sendTransactionAsync(assetProxy.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(assetProxy: string, txData?: Partial | undefined): Promise { - assert.isString('assetProxy', assetProxy); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + assetProxy: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('assetProxy', assetProxy); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( assetProxy: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('assetProxy', assetProxy); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -3509,8 +2755,9 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase()]); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -3519,46 +2766,35 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(assetProxy: string): string { + getABIEncodedTransactionData( + assetProxy: string, + ): string { assert.isString('assetProxy', assetProxy); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address)', [ - assetProxy.toLowerCase(), - ]); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public getOrderInfo = { async callAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }> { + ): Promise<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber} + > { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -3567,11 +2803,9 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', - [order], - ); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -3580,173 +2814,107 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', - ); + const abiEncoder = self._lookupAbiEncoder('getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ - orderStatus: number; - orderHash: string; - orderTakerAssetFilledAmount: BigNumber; - }>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber} + >(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }): string { - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', - [order], - ); + getABIEncodedTransactionData( + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + ): string { + + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order + ]); return abiEncodedTransactionData; }, }; public cancelOrder = { async sendTransactionAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - txData?: Partial | undefined, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + txData?: Partial | undefined, ): Promise { - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', - [order], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.cancelOrder.estimateGasAsync.bind(self, order), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.cancelOrder.estimateGasAsync.bind( + self, + order + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - const self = (this as any) as ExchangeContract; - const txHashPromise = self.cancelOrder.sendTransactionAsync(order, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + + const self = this as any as ExchangeContract; + const txHashPromise = self.cancelOrder.sendTransactionAsync(order + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, txData?: Partial | undefined, ): Promise { - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', - [order], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -3755,11 +2923,9 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', - [order], - ); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -3768,39 +2934,24 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', - ); + const abiEncoder = self._lookupAbiEncoder('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }): string { - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', - [order], - ); + getABIEncodedTransactionData( + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + ): string { + + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order + ]); return abiEncodedTransactionData; }, }; @@ -3810,7 +2961,8 @@ export class ExchangeContract extends BaseContract { index_1: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.isString('index_1', index_1); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -3821,11 +2973,10 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('orderEpoch(address,address)', [ - index_0.toLowerCase(), - index_1.toLowerCase(), - ]); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('orderEpoch(address,address)', [index_0.toLowerCase(), + index_1.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -3834,31 +2985,36 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('orderEpoch(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: string, index_1: string): string { + getABIEncodedTransactionData( + index_0: string, + index_1: string, + ): string { assert.isString('index_0', index_0); assert.isString('index_1', index_1); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('orderEpoch(address,address)', [ - index_0.toLowerCase(), - index_1.toLowerCase(), - ]); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('orderEpoch(address,address)', [index_0.toLowerCase(), + index_1.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public ZRX_ASSET_DATA = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -3867,7 +3023,7 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; + const self = this as any as ExchangeContract; const encodedData = self._strictEncodeArguments('ZRX_ASSET_DATA()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -3877,178 +3033,125 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('ZRX_ASSET_DATA()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as ExchangeContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as ExchangeContract; const abiEncodedTransactionData = self._strictEncodeArguments('ZRX_ASSET_DATA()', []); return abiEncodedTransactionData; }, }; public marketSellOrdersNoThrow = { async sendTransactionAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmount: BigNumber, signatures: string[], - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - [orders, takerAssetFillAmount, signatures], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.marketSellOrdersNoThrow.estimateGasAsync.bind(self, orders, takerAssetFillAmount, signatures), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isArray('orders', orders); + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + takerAssetFillAmount, + signatures + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.marketSellOrdersNoThrow.estimateGasAsync.bind( + self, + orders, + takerAssetFillAmount, + signatures + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.marketSellOrdersNoThrow.sendTransactionAsync( - orders, - takerAssetFillAmount, - signatures, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const txHashPromise = self.marketSellOrdersNoThrow.sendTransactionAsync(orders, + takerAssetFillAmount, + signatures + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - [orders, takerAssetFillAmount, signatures], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + takerAssetFillAmount, + signatures + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmount: BigNumber, signatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }> { + ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + > { assert.isArray('orders', orders); assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isArray('signatures', signatures); @@ -4060,11 +3163,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - [orders, takerAssetFillAmount, signatures], - ); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + takerAssetFillAmount, + signatures + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -4073,56 +3176,39 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - ); + const abiEncoder = self._lookupAbiEncoder('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, - takerAssetFillAmount: BigNumber, - signatures: string[], - ): string { + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + takerAssetFillAmount: BigNumber, + signatures: string[], + ): string { assert.isArray('orders', orders); assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - [orders, takerAssetFillAmount, signatures], - ); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + takerAssetFillAmount, + signatures + ]); return abiEncodedTransactionData; }, }; public EIP712_DOMAIN_HASH = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -4131,7 +3217,7 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; + const self = this as any as ExchangeContract; const encodedData = self._strictEncodeArguments('EIP712_DOMAIN_HASH()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -4141,178 +3227,125 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('EIP712_DOMAIN_HASH()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as ExchangeContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as ExchangeContract; const abiEncodedTransactionData = self._strictEncodeArguments('EIP712_DOMAIN_HASH()', []); return abiEncodedTransactionData; }, }; public marketBuyOrders = { async sendTransactionAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, makerAssetFillAmount: BigNumber, signatures: string[], - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - [orders, makerAssetFillAmount, signatures], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.marketBuyOrders.estimateGasAsync.bind(self, orders, makerAssetFillAmount, signatures), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + makerAssetFillAmount, + signatures + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.marketBuyOrders.estimateGasAsync.bind( + self, + orders, + makerAssetFillAmount, + signatures + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, makerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.marketBuyOrders.sendTransactionAsync( - orders, - makerAssetFillAmount, - signatures, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const txHashPromise = self.marketBuyOrders.sendTransactionAsync(orders, + makerAssetFillAmount, + signatures + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, makerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - [orders, makerAssetFillAmount, signatures], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + makerAssetFillAmount, + signatures + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, makerAssetFillAmount: BigNumber, signatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }> { + ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + > { assert.isArray('orders', orders); assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); assert.isArray('signatures', signatures); @@ -4324,11 +3357,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - [orders, makerAssetFillAmount, signatures], - ); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + makerAssetFillAmount, + signatures + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -4337,56 +3370,39 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - ); + const abiEncoder = self._lookupAbiEncoder('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, - makerAssetFillAmount: BigNumber, - signatures: string[], - ): string { + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + makerAssetFillAmount: BigNumber, + signatures: string[], + ): string { assert.isArray('orders', orders); assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - [orders, makerAssetFillAmount, signatures], - ); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + makerAssetFillAmount, + signatures + ]); return abiEncodedTransactionData; }, }; public currentContextAddress = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -4395,7 +3411,7 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; + const self = this as any as ExchangeContract; const encodedData = self._strictEncodeArguments('currentContextAddress()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -4405,44 +3421,51 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('currentContextAddress()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as ExchangeContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as ExchangeContract; const abiEncodedTransactionData = self._strictEncodeArguments('currentContextAddress()', []); return abiEncodedTransactionData; }, }; public transferOwnership = { - async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + newOwner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('newOwner', newOwner); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferOwnership.estimateGasAsync.bind( + self, + newOwner.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( newOwner: string, @@ -4450,41 +3473,51 @@ export class ExchangeContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('newOwner', newOwner); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('newOwner', newOwner); + const self = this as any as ExchangeContract; + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + newOwner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('newOwner', newOwner); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + newOwner: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -4494,8 +3527,9 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -4504,29 +3538,33 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(newOwner: string): string { + getABIEncodedTransactionData( + newOwner: string, + ): string { assert.isString('newOwner', newOwner); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ - newOwner.toLowerCase(), - ]); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public VERSION = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -4535,7 +3573,7 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; + const self = this as any as ExchangeContract; const encodedData = self._strictEncodeArguments('VERSION()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -4545,30 +3583,31 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('VERSION()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as ExchangeContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as ExchangeContract; const abiEncodedTransactionData = self._strictEncodeArguments('VERSION()', []); return abiEncodedTransactionData; }, }; - private readonly _subscriptionManager: SubscriptionManager; - public static async deployFrom0xArtifactAsync( +private readonly _subscriptionManager: SubscriptionManager; +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - _zrxAssetData: string, + artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + _zrxAssetData: string, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -4581,14 +3620,17 @@ 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); + const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); + return ExchangeContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, _zrxAssetData +); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, - _zrxAssetData: string, + abiDependencies: { [contractName: string]: ContractAbi }, + _zrxAssetData: string, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -4598,17 +3640,20 @@ export class ExchangeContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_zrxAssetData] = BaseContract._formatABIDataItemList( + [_zrxAssetData +] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [_zrxAssetData], + [_zrxAssetData +], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_zrxAssetData]); + const txData = deployInfo.encode(bytecode, [_zrxAssetData +]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -4616,17 +3661,19 @@ export class ExchangeContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`Exchange successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ExchangeContract(txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = [_zrxAssetData]; + const contractInstance = new ExchangeContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); + contractInstance.constructorArgs = [_zrxAssetData +]; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -4645,7 +3692,7 @@ export class ExchangeContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -4700,7 +3747,7 @@ export class ExchangeContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'takerAssetFillAmounts', @@ -4733,14 +3780,14 @@ export class ExchangeContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -4759,7 +3806,7 @@ export class ExchangeContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -4776,12 +3823,13 @@ export class ExchangeContract extends BaseContract { }, ], name: 'preSign', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -4836,7 +3884,7 @@ export class ExchangeContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'rightOrder', @@ -4890,7 +3938,7 @@ export class ExchangeContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'leftSignature', @@ -4927,7 +3975,7 @@ export class ExchangeContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, { name: 'right', @@ -4949,20 +3997,20 @@ export class ExchangeContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, { name: 'leftMakerAssetSpreadAmount', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -5017,7 +4065,7 @@ export class ExchangeContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'takerAssetFillAmount', @@ -5050,14 +4098,14 @@ export class ExchangeContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -5076,7 +4124,7 @@ export class ExchangeContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -5131,16 +4179,17 @@ export class ExchangeContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, ], name: 'batchCancelOrders', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -5195,7 +4244,7 @@ export class ExchangeContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'takerAssetFillAmounts', @@ -5228,14 +4277,14 @@ export class ExchangeContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -5244,12 +4293,13 @@ export class ExchangeContract extends BaseContract { }, ], name: 'cancelOrdersUpTo', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -5304,7 +4354,7 @@ export class ExchangeContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'takerAssetFillAmounts', @@ -5337,14 +4387,14 @@ export class ExchangeContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -5363,7 +4413,7 @@ export class ExchangeContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -5382,7 +4432,7 @@ export class ExchangeContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -5437,7 +4487,7 @@ export class ExchangeContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'takerAssetFillAmount', @@ -5470,14 +4520,14 @@ export class ExchangeContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -5490,12 +4540,13 @@ export class ExchangeContract extends BaseContract { }, ], name: 'setSignatureValidatorApproval', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -5518,7 +4569,7 @@ export class ExchangeContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -5573,7 +4624,7 @@ export class ExchangeContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'takerAssetFillAmount', @@ -5606,14 +4657,14 @@ export class ExchangeContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -5668,7 +4719,7 @@ export class ExchangeContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, ], name: 'getOrdersInfo', @@ -5689,14 +4740,14 @@ export class ExchangeContract extends BaseContract { name: 'orderTakerAssetFilledAmount', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -5719,9 +4770,10 @@ export class ExchangeContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'owner', outputs: [ { @@ -5733,7 +4785,7 @@ export class ExchangeContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -5760,7 +4812,7 @@ export class ExchangeContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -5815,7 +4867,7 @@ export class ExchangeContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'makerAssetFillAmount', @@ -5848,14 +4900,14 @@ export class ExchangeContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -5910,7 +4962,7 @@ export class ExchangeContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'takerAssetFillAmount', @@ -5943,14 +4995,14 @@ export class ExchangeContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -5971,12 +5023,13 @@ export class ExchangeContract extends BaseContract { }, ], name: 'executeTransaction', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -5985,12 +5038,13 @@ export class ExchangeContract extends BaseContract { }, ], name: 'registerAssetProxy', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -6045,7 +5099,7 @@ export class ExchangeContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, ], name: 'getOrderInfo', @@ -6066,14 +5120,14 @@ export class ExchangeContract extends BaseContract { name: 'orderTakerAssetFilledAmount', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -6128,16 +5182,17 @@ export class ExchangeContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, ], name: 'cancelOrder', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -6160,9 +5215,10 @@ export class ExchangeContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'ZRX_ASSET_DATA', outputs: [ { @@ -6174,7 +5230,7 @@ export class ExchangeContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -6229,7 +5285,7 @@ export class ExchangeContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'takerAssetFillAmount', @@ -6262,16 +5318,17 @@ export class ExchangeContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'EIP712_DOMAIN_HASH', outputs: [ { @@ -6283,7 +5340,7 @@ export class ExchangeContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -6338,7 +5395,7 @@ export class ExchangeContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'makerAssetFillAmount', @@ -6371,16 +5428,17 @@ export class ExchangeContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'currentContextAddress', outputs: [ { @@ -6392,7 +5450,7 @@ export class ExchangeContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -6401,14 +5459,16 @@ export class ExchangeContract extends BaseContract { }, ], name: 'transferOwnership', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'VERSION', outputs: [ { @@ -6420,19 +5480,20 @@ export class ExchangeContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { inputs: [ { name: '_zrxAssetData', type: 'bytes', }, ], - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'constructor', }, - { + { anonymous: false, inputs: [ { @@ -6452,10 +5513,11 @@ export class ExchangeContract extends BaseContract { }, ], name: 'SignatureValidatorApproval', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -6515,10 +5577,11 @@ export class ExchangeContract extends BaseContract { }, ], name: 'Fill', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -6553,10 +5616,11 @@ export class ExchangeContract extends BaseContract { }, ], name: 'Cancel', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -6576,10 +5640,11 @@ export class ExchangeContract extends BaseContract { }, ], name: 'CancelUpTo', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -6594,7 +5659,8 @@ export class ExchangeContract extends BaseContract { }, ], name: 'AssetProxyRegistered', - outputs: [], + outputs: [ + ], type: 'event', }, ] as ContractAbi; @@ -6668,15 +5734,15 @@ export class ExchangeContract extends BaseContract { ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial) { - super('Exchange', ExchangeContract.ABI(), address, supportedProvider, txDefaults); + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + super('Exchange', ExchangeContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( ExchangeContract.ABI(), this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts b/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts index d183a2261c..8534657a74 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts @@ -1,7 +1,7 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract'; +import { BaseContract,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -21,125 +21,71 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; +import * as _ from 'lodash'; // tslint:enable:no-unused-variable + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class ForwarderContract extends BaseContract { public marketBuyOrdersWithEth = { async sendTransactionAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, makerAssetFillAmount: BigNumber, signatures: string[], - feeOrders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, feeSignatures: string[], feePercentage: BigNumber, feeRecipient: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - assert.isArray('feeOrders', feeOrders); - assert.isArray('feeSignatures', feeSignatures); - assert.isBigNumber('feePercentage', feePercentage); - assert.isString('feeRecipient', feeRecipient); - const self = (this as any) as ForwarderContract; - const encodedData = self._strictEncodeArguments( - 'marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', - [ - orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase(), - ], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.marketBuyOrdersWithEth.estimateGasAsync.bind( - self, - orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase(), - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + assert.isArray('feeOrders', feeOrders); + assert.isArray('feeSignatures', feeSignatures); + assert.isBigNumber('feePercentage', feePercentage); + assert.isString('feeRecipient', feeRecipient); + const self = this as any as ForwarderContract; + const encodedData = self._strictEncodeArguments('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, + makerAssetFillAmount, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.marketBuyOrdersWithEth.estimateGasAsync.bind( + self, + orders, + makerAssetFillAmount, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, makerAssetFillAmount: BigNumber, signatures: string[], - feeOrders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, feeSignatures: string[], feePercentage: BigNumber, feeRecipient: string, @@ -147,158 +93,86 @@ export class ForwarderContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - assert.isArray('feeOrders', feeOrders); - assert.isArray('feeSignatures', feeSignatures); - assert.isBigNumber('feePercentage', feePercentage); - assert.isString('feeRecipient', feeRecipient); - const self = (this as any) as ForwarderContract; - const txHashPromise = self.marketBuyOrdersWithEth.sendTransactionAsync( - orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase(), - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + assert.isArray('feeOrders', feeOrders); + assert.isArray('feeSignatures', feeSignatures); + assert.isBigNumber('feePercentage', feePercentage); + assert.isString('feeRecipient', feeRecipient); + const self = this as any as ForwarderContract; + const txHashPromise = self.marketBuyOrdersWithEth.sendTransactionAsync(orders, + makerAssetFillAmount, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, makerAssetFillAmount: BigNumber, signatures: string[], - feeOrders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, feeSignatures: string[], feePercentage: BigNumber, feeRecipient: string, txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - assert.isArray('feeOrders', feeOrders); - assert.isArray('feeSignatures', feeSignatures); - assert.isBigNumber('feePercentage', feePercentage); - assert.isString('feeRecipient', feeRecipient); - const self = (this as any) as ForwarderContract; - const encodedData = self._strictEncodeArguments( - 'marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', - [ - orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase(), - ], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + assert.isArray('feeOrders', feeOrders); + assert.isArray('feeSignatures', feeSignatures); + assert.isBigNumber('feePercentage', feePercentage); + assert.isString('feeRecipient', feeRecipient); + const self = this as any as ForwarderContract; + const encodedData = self._strictEncodeArguments('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, + makerAssetFillAmount, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, makerAssetFillAmount: BigNumber, signatures: string[], - feeOrders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, feeSignatures: string[], feePercentage: BigNumber, feeRecipient: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise< - [ - { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }, - { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - } - ] + ): Promise<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}] > { assert.isArray('orders', orders); assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); @@ -315,19 +189,15 @@ export class ForwarderContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ForwarderContract; - const encodedData = self._strictEncodeArguments( - 'marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', - [ - orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase(), - ], - ); + const self = this as any as ForwarderContract; + const encodedData = self._strictEncodeArguments('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, + makerAssetFillAmount, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -336,70 +206,26 @@ export class ForwarderContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(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)', - ); + const abiEncoder = self._lookupAbiEncoder('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue< - [ - { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }, - { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - } - ] - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}] + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, - makerAssetFillAmount: BigNumber, - signatures: string[], - feeOrders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, - feeSignatures: string[], - feePercentage: BigNumber, - feeRecipient: string, - ): string { + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + makerAssetFillAmount: BigNumber, + signatures: string[], + feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + feeSignatures: string[], + feePercentage: BigNumber, + feeRecipient: string, + ): string { assert.isArray('orders', orders); assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); assert.isArray('signatures', signatures); @@ -407,19 +233,15 @@ export class ForwarderContract extends BaseContract { assert.isArray('feeSignatures', feeSignatures); assert.isBigNumber('feePercentage', feePercentage); assert.isString('feeRecipient', feeRecipient); - const self = (this as any) as ForwarderContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', - [ - orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase(), - ], - ); + const self = this as any as ForwarderContract; + const abiEncodedTransactionData = self._strictEncodeArguments('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, + makerAssetFillAmount, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase() + ]); return abiEncodedTransactionData; }, }; @@ -427,27 +249,33 @@ export class ForwarderContract extends BaseContract { async sendTransactionAsync( assetData: string, amount: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('assetData', assetData); - assert.isBigNumber('amount', amount); - const self = (this as any) as ForwarderContract; - const encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData, amount]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.withdrawAsset.estimateGasAsync.bind(self, assetData, amount), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isString('assetData', assetData); + assert.isBigNumber('amount', amount); + const self = this as any as ForwarderContract; + const encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData, + amount + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.withdrawAsset.estimateGasAsync.bind( + self, + assetData, + amount + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( assetData: string, @@ -456,52 +284,57 @@ export class ForwarderContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('assetData', assetData); - assert.isBigNumber('amount', amount); - const self = (this as any) as ForwarderContract; - const txHashPromise = self.withdrawAsset.sendTransactionAsync(assetData, amount, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('assetData', assetData); + assert.isBigNumber('amount', amount); + const self = this as any as ForwarderContract; + const txHashPromise = self.withdrawAsset.sendTransactionAsync(assetData, + amount + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( assetData: string, amount: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('assetData', assetData); - assert.isBigNumber('amount', amount); - const self = (this as any) as ForwarderContract; - const encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData, amount]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('assetData', assetData); + assert.isBigNumber('amount', amount); + const self = this as any as ForwarderContract; + const encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData, + amount + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( assetData: string, amount: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('assetData', assetData); assert.isBigNumber('amount', amount); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -512,8 +345,10 @@ export class ForwarderContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ForwarderContract; - const encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData, amount]); + const self = this as any as ForwarderContract; + const encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData, + amount + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -522,31 +357,36 @@ export class ForwarderContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('withdrawAsset(bytes,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(assetData: string, amount: BigNumber): string { + getABIEncodedTransactionData( + assetData: string, + amount: BigNumber, + ): string { assert.isString('assetData', assetData); assert.isBigNumber('amount', amount); - const self = (this as any) as ForwarderContract; - const abiEncodedTransactionData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [ - assetData, - amount, - ]); + const self = this as any as ForwarderContract; + const abiEncodedTransactionData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData, + amount + ]); return abiEncodedTransactionData; }, }; public owner = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -555,7 +395,7 @@ export class ForwarderContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ForwarderContract; + const self = this as any as ForwarderContract; const encodedData = self._strictEncodeArguments('owner()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -565,125 +405,76 @@ export class ForwarderContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as ForwarderContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as ForwarderContract; const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); return abiEncodedTransactionData; }, }; public marketSellOrdersWithEth = { async sendTransactionAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, signatures: string[], - feeOrders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, feeSignatures: string[], feePercentage: BigNumber, feeRecipient: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isArray('signatures', signatures); - assert.isArray('feeOrders', feeOrders); - assert.isArray('feeSignatures', feeSignatures); - assert.isBigNumber('feePercentage', feePercentage); - assert.isString('feeRecipient', feeRecipient); - const self = (this as any) as ForwarderContract; - const encodedData = self._strictEncodeArguments( - 'marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', - [orders, signatures, feeOrders, feeSignatures, feePercentage, feeRecipient.toLowerCase()], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.marketSellOrdersWithEth.estimateGasAsync.bind( - self, - orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase(), - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isArray('orders', orders); + assert.isArray('signatures', signatures); + assert.isArray('feeOrders', feeOrders); + assert.isArray('feeSignatures', feeSignatures); + assert.isBigNumber('feePercentage', feePercentage); + assert.isString('feeRecipient', feeRecipient); + const self = this as any as ForwarderContract; + const encodedData = self._strictEncodeArguments('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.marketSellOrdersWithEth.estimateGasAsync.bind( + self, + orders, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, signatures: string[], - feeOrders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, feeSignatures: string[], feePercentage: BigNumber, feeRecipient: string, @@ -691,145 +482,80 @@ export class ForwarderContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isArray('signatures', signatures); - assert.isArray('feeOrders', feeOrders); - assert.isArray('feeSignatures', feeSignatures); - assert.isBigNumber('feePercentage', feePercentage); - assert.isString('feeRecipient', feeRecipient); - const self = (this as any) as ForwarderContract; - const txHashPromise = self.marketSellOrdersWithEth.sendTransactionAsync( - orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase(), - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isArray('signatures', signatures); + assert.isArray('feeOrders', feeOrders); + assert.isArray('feeSignatures', feeSignatures); + assert.isBigNumber('feePercentage', feePercentage); + assert.isString('feeRecipient', feeRecipient); + const self = this as any as ForwarderContract; + const txHashPromise = self.marketSellOrdersWithEth.sendTransactionAsync(orders, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, signatures: string[], - feeOrders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, feeSignatures: string[], feePercentage: BigNumber, feeRecipient: string, txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isArray('signatures', signatures); - assert.isArray('feeOrders', feeOrders); - assert.isArray('feeSignatures', feeSignatures); - assert.isBigNumber('feePercentage', feePercentage); - assert.isString('feeRecipient', feeRecipient); - const self = (this as any) as ForwarderContract; - const encodedData = self._strictEncodeArguments( - 'marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', - [orders, signatures, feeOrders, feeSignatures, feePercentage, feeRecipient.toLowerCase()], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isArray('signatures', signatures); + assert.isArray('feeOrders', feeOrders); + assert.isArray('feeSignatures', feeSignatures); + assert.isBigNumber('feePercentage', feePercentage); + assert.isString('feeRecipient', feeRecipient); + const self = this as any as ForwarderContract; + const encodedData = self._strictEncodeArguments('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, signatures: string[], - feeOrders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, feeSignatures: string[], feePercentage: BigNumber, feeRecipient: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise< - [ - { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }, - { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - } - ] + ): Promise<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}] > { assert.isArray('orders', orders); assert.isArray('signatures', signatures); @@ -845,11 +571,14 @@ export class ForwarderContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ForwarderContract; - const encodedData = self._strictEncodeArguments( - 'marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', - [orders, signatures, feeOrders, feeSignatures, feePercentage, feeRecipient.toLowerCase()], - ); + const self = this as any as ForwarderContract; + const encodedData = self._strictEncodeArguments('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -858,103 +587,69 @@ export class ForwarderContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(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)', - ); + const abiEncoder = self._lookupAbiEncoder('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue< - [ - { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }, - { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - } - ] - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}] + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, - signatures: string[], - feeOrders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, - feeSignatures: string[], - feePercentage: BigNumber, - feeRecipient: string, - ): string { + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + signatures: string[], + feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + feeSignatures: string[], + feePercentage: BigNumber, + feeRecipient: string, + ): string { assert.isArray('orders', orders); assert.isArray('signatures', signatures); assert.isArray('feeOrders', feeOrders); assert.isArray('feeSignatures', feeSignatures); assert.isBigNumber('feePercentage', feePercentage); assert.isString('feeRecipient', feeRecipient); - const self = (this as any) as ForwarderContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', - [orders, signatures, feeOrders, feeSignatures, feePercentage, feeRecipient.toLowerCase()], - ); + const self = this as any as ForwarderContract; + const abiEncodedTransactionData = self._strictEncodeArguments('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public transferOwnership = { - async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as ForwarderContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + newOwner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('newOwner', newOwner); + const self = this as any as ForwarderContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferOwnership.estimateGasAsync.bind( + self, + newOwner.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( newOwner: string, @@ -962,41 +657,51 @@ export class ForwarderContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('newOwner', newOwner); - const self = (this as any) as ForwarderContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('newOwner', newOwner); + const self = this as any as ForwarderContract; + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as ForwarderContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + newOwner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('newOwner', newOwner); + const self = this as any as ForwarderContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + newOwner: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1006,8 +711,9 @@ export class ForwarderContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ForwarderContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const self = this as any as ForwarderContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1016,34 +722,35 @@ export class ForwarderContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(newOwner: string): string { + getABIEncodedTransactionData( + newOwner: string, + ): string { assert.isString('newOwner', newOwner); - const self = (this as any) as ForwarderContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ - newOwner.toLowerCase(), - ]); + const self = this as any as ForwarderContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); return abiEncodedTransactionData; }, }; - public static async deployFrom0xArtifactAsync( +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - _exchange: string, - _zrxAssetData: string, - _wethAssetData: string, + artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + _exchange: string, + _zrxAssetData: string, + _wethAssetData: string, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -1056,24 +763,21 @@ export class ForwarderContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - return ForwarderContract.deployAsync( - bytecode, - abi, - provider, - txDefaults, - _exchange, - _zrxAssetData, - _wethAssetData, - ); + const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); + return ForwarderContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, _exchange, +_zrxAssetData, +_wethAssetData +); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, - _exchange: string, - _zrxAssetData: string, - _wethAssetData: string, + abiDependencies: { [contractName: string]: ContractAbi }, + _exchange: string, + _zrxAssetData: string, + _wethAssetData: string, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -1083,17 +787,26 @@ export class ForwarderContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_exchange, _zrxAssetData, _wethAssetData] = BaseContract._formatABIDataItemList( + [_exchange, +_zrxAssetData, +_wethAssetData +] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [_exchange, _zrxAssetData, _wethAssetData], + [_exchange, +_zrxAssetData, +_wethAssetData +], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_exchange, _zrxAssetData, _wethAssetData]); + const txData = deployInfo.encode(bytecode, [_exchange, +_zrxAssetData, +_wethAssetData +]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -1101,17 +814,21 @@ export class ForwarderContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`Forwarder successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ForwarderContract(txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = [_exchange, _zrxAssetData, _wethAssetData]; + const contractInstance = new ForwarderContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); + contractInstance.constructorArgs = [_exchange, +_zrxAssetData, +_wethAssetData +]; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: false, inputs: [ { @@ -1166,7 +883,7 @@ export class ForwarderContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'makerAssetFillAmount', @@ -1228,7 +945,7 @@ export class ForwarderContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'feeSignatures', @@ -1265,7 +982,7 @@ export class ForwarderContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, { name: 'feeOrderFillResults', @@ -1287,14 +1004,14 @@ export class ForwarderContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, ], payable: true, stateMutability: 'payable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1307,14 +1024,16 @@ export class ForwarderContract extends BaseContract { }, ], name: 'withdrawAsset', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'owner', outputs: [ { @@ -1326,7 +1045,7 @@ export class ForwarderContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1381,7 +1100,7 @@ export class ForwarderContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'signatures', @@ -1439,7 +1158,7 @@ export class ForwarderContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'feeSignatures', @@ -1476,7 +1195,7 @@ export class ForwarderContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, { name: 'feeOrderFillResults', @@ -1498,14 +1217,14 @@ export class ForwarderContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, ], payable: true, stateMutability: 'payable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1514,12 +1233,13 @@ export class ForwarderContract extends BaseContract { }, ], name: 'transferOwnership', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { inputs: [ { name: '_exchange', @@ -1534,14 +1254,17 @@ export class ForwarderContract extends BaseContract { type: 'bytes', }, ], - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'constructor', }, - { - inputs: [], - outputs: [], + { + inputs: [ + ], + outputs: [ + ], payable: true, stateMutability: 'payable', type: 'fallback', @@ -1549,11 +1272,11 @@ export class ForwarderContract extends BaseContract { ] as ContractAbi; return abi; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial) { - super('Forwarder', ForwarderContract.ABI(), address, supportedProvider, txDefaults); + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + super('Forwarder', ForwarderContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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..177f842968 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 @@ -1,7 +1,7 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract'; +import { BaseContract,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -21,32 +21,41 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; +import * as _ from 'lodash'; // tslint:enable:no-unused-variable + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class IAssetProxyContract extends BaseContract { public addAuthorizedAddress = { - async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.addAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + target: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('target', target); + const self = this as any as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.addAuthorizedAddress.estimateGasAsync.bind( + self, + target.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -54,41 +63,51 @@ export class IAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = (this as any) as IAssetProxyContract; - const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + const self = this as any as IAssetProxyContract; + const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + target: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('target', target); + const self = this as any as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + target: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('target', target); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -98,8 +117,9 @@ export class IAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); + const self = this as any as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -108,47 +128,54 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(target: string): string { + getABIEncodedTransactionData( + target: string, + ): string { assert.isString('target', target); - const self = (this as any) as IAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [ - target.toLowerCase(), - ]); + const self = this as any as IAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public removeAuthorizedAddress = { - async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + target: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('target', target); + const self = this as any as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeAuthorizedAddress.estimateGasAsync.bind( + self, + target.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -156,41 +183,51 @@ export class IAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = (this as any) as IAssetProxyContract; - const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + const self = this as any as IAssetProxyContract; + const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + target: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('target', target); + const self = this as any as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + target: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('target', target); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -200,8 +237,9 @@ export class IAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); + const self = this as any as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -210,24 +248,24 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(target: string): string { + getABIEncodedTransactionData( + target: string, + ): string { assert.isString('target', target); - const self = (this as any) as IAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [ - target.toLowerCase(), - ]); + const self = this as any as IAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() + ]); return abiEncodedTransactionData; }, }; @@ -235,30 +273,33 @@ export class IAssetProxyContract extends BaseContract { async sendTransactionAsync( target: string, index: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = this as any as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), + index + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind( + self, target.toLowerCase(), - index, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(self, target.toLowerCase(), index), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + index + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -267,59 +308,57 @@ export class IAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as IAssetProxyContract; - const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync( - target.toLowerCase(), - index, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = this as any as IAssetProxyContract; + const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync(target.toLowerCase(), + index + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( target: string, index: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target.toLowerCase(), - index, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = this as any as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), + index + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( target: string, index: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('target', target); assert.isBigNumber('index', index); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -330,11 +369,10 @@ export class IAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target.toLowerCase(), - index, - ]); + const self = this as any as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), + index + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -343,26 +381,27 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(target: string, index: BigNumber): string { + getABIEncodedTransactionData( + target: string, + index: BigNumber, + ): string { assert.isString('target', target); assert.isBigNumber('index', index); - const self = (this as any) as IAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'removeAuthorizedAddressAtIndex(address,uint256)', - [target.toLowerCase(), index], - ); + const self = this as any as IAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), + index + ]); return abiEncodedTransactionData; }, }; @@ -372,34 +411,39 @@ export class IAssetProxyContract extends BaseContract { from: string, to: string, amount: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('assetData', assetData); - assert.isString('from', from); - assert.isString('to', to); - assert.isBigNumber('amount', amount); - const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [ + assert.isString('assetData', assetData); + assert.isString('from', from); + assert.isString('to', to); + assert.isBigNumber('amount', amount); + const self = this as any as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [assetData, + from.toLowerCase(), + to.toLowerCase(), + amount + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferFrom.estimateGasAsync.bind( + self, assetData, from.toLowerCase(), to.toLowerCase(), - amount, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind(self, assetData, from.toLowerCase(), to.toLowerCase(), amount), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + amount + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( assetData: string, @@ -410,29 +454,27 @@ export class IAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('assetData', assetData); - assert.isString('from', from); - assert.isString('to', to); - assert.isBigNumber('amount', amount); - const self = (this as any) as IAssetProxyContract; - const txHashPromise = self.transferFrom.sendTransactionAsync( - assetData, - from.toLowerCase(), - to.toLowerCase(), - amount, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('assetData', assetData); + assert.isString('from', from); + assert.isString('to', to); + assert.isBigNumber('amount', amount); + const self = this as any as IAssetProxyContract; + const txHashPromise = self.transferFrom.sendTransactionAsync(assetData, + from.toLowerCase(), + to.toLowerCase(), + amount + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( assetData: string, @@ -441,31 +483,30 @@ export class IAssetProxyContract extends BaseContract { amount: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('assetData', assetData); - assert.isString('from', from); - assert.isString('to', to); - assert.isBigNumber('amount', amount); - const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [ - assetData, - from.toLowerCase(), - to.toLowerCase(), - amount, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('assetData', assetData); + assert.isString('from', from); + assert.isString('to', to); + assert.isBigNumber('amount', amount); + const self = this as any as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [assetData, + from.toLowerCase(), + to.toLowerCase(), + amount + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( assetData: string, @@ -474,7 +515,8 @@ export class IAssetProxyContract extends BaseContract { amount: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('assetData', assetData); assert.isString('from', from); assert.isString('to', to); @@ -487,13 +529,12 @@ export class IAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [ - assetData, - from.toLowerCase(), - to.toLowerCase(), - amount, - ]); + const self = this as any as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [assetData, + from.toLowerCase(), + to.toLowerCase(), + amount + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -502,33 +543,42 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(bytes,address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(assetData: string, from: string, to: string, amount: BigNumber): string { + getABIEncodedTransactionData( + assetData: string, + from: string, + to: string, + amount: BigNumber, + ): string { assert.isString('assetData', assetData); assert.isString('from', from); assert.isString('to', to); assert.isBigNumber('amount', amount); - const self = (this as any) as IAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'transferFrom(bytes,address,address,uint256)', - [assetData, from.toLowerCase(), to.toLowerCase(), amount], - ); + const self = this as any as IAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [assetData, + from.toLowerCase(), + to.toLowerCase(), + amount + ]); return abiEncodedTransactionData; }, }; public getProxyId = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -537,7 +587,7 @@ export class IAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as IAssetProxyContract; + const self = this as any as IAssetProxyContract; const encodedData = self._strictEncodeArguments('getProxyId()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -547,26 +597,30 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getProxyId()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as IAssetProxyContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as IAssetProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('getProxyId()', []); return abiEncodedTransactionData; }, }; public getAuthorizedAddresses = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -575,7 +629,7 @@ export class IAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as IAssetProxyContract; + const self = this as any as IAssetProxyContract; const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -585,44 +639,51 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as IAssetProxyContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as IAssetProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('getAuthorizedAddresses()', []); return abiEncodedTransactionData; }, }; public transferOwnership = { - async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + newOwner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('newOwner', newOwner); + const self = this as any as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferOwnership.estimateGasAsync.bind( + self, + newOwner.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( newOwner: string, @@ -630,41 +691,51 @@ export class IAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('newOwner', newOwner); - const self = (this as any) as IAssetProxyContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('newOwner', newOwner); + const self = this as any as IAssetProxyContract; + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + newOwner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('newOwner', newOwner); + const self = this as any as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + newOwner: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -674,8 +745,9 @@ export class IAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const self = this as any as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -684,31 +756,32 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(newOwner: string): string { + getABIEncodedTransactionData( + newOwner: string, + ): string { assert.isString('newOwner', newOwner); - const self = (this as any) as IAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ - newOwner.toLowerCase(), - ]); + const self = this as any as IAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); return abiEncodedTransactionData; }, }; - public static async deployFrom0xArtifactAsync( +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, + artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -721,13 +794,15 @@ export class IAssetProxyContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - return IAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults); + const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); + return IAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, ); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, + abiDependencies: { [contractName: string]: ContractAbi }, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -737,13 +812,17 @@ export class IAssetProxyContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); + [] = BaseContract._formatABIDataItemList( + constructorAbi.inputs, + [], + BaseContract._bigNumberToString, + ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -751,17 +830,18 @@ export class IAssetProxyContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`IAssetProxy successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new IAssetProxyContract(txReceipt.contractAddress as string, provider, txDefaults); + const contractInstance = new IAssetProxyContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); contractInstance.constructorArgs = []; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: false, inputs: [ { @@ -770,12 +850,13 @@ export class IAssetProxyContract extends BaseContract { }, ], name: 'addAuthorizedAddress', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -784,12 +865,13 @@ export class IAssetProxyContract extends BaseContract { }, ], name: 'removeAuthorizedAddress', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -802,12 +884,13 @@ export class IAssetProxyContract extends BaseContract { }, ], name: 'removeAuthorizedAddressAtIndex', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -828,14 +911,16 @@ export class IAssetProxyContract extends BaseContract { }, ], name: 'transferFrom', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'getProxyId', outputs: [ { @@ -847,9 +932,10 @@ export class IAssetProxyContract extends BaseContract { stateMutability: 'pure', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'getAuthorizedAddresses', outputs: [ { @@ -861,7 +947,7 @@ export class IAssetProxyContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -870,7 +956,8 @@ export class IAssetProxyContract extends BaseContract { }, ], name: 'transferOwnership', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', @@ -878,11 +965,11 @@ export class IAssetProxyContract extends BaseContract { ] as ContractAbi; return abi; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial) { - super('IAssetProxy', IAssetProxyContract.ABI(), address, supportedProvider, txDefaults); + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + super('IAssetProxy', IAssetProxyContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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..ace17f02b1 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts @@ -1,7 +1,7 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract'; +import { BaseContract,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -21,8 +21,10 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; +import * as _ from 'lodash'; // tslint:enable:no-unused-variable + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name @@ -34,7 +36,8 @@ export class IValidatorContract extends BaseContract { signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('hash', hash); assert.isString('signerAddress', signerAddress); assert.isString('signature', signature); @@ -46,12 +49,11 @@ export class IValidatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as IValidatorContract; - const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [ - hash, - signerAddress.toLowerCase(), - signature, - ]); + const self = this as any as IValidatorContract; + const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [hash, + signerAddress.toLowerCase(), + signature + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -60,35 +62,38 @@ export class IValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isValidSignature(bytes32,address,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(hash: string, signerAddress: string, signature: string): string { + getABIEncodedTransactionData( + hash: string, + signerAddress: string, + signature: string, + ): string { assert.isString('hash', hash); assert.isString('signerAddress', signerAddress); assert.isString('signature', signature); - const self = (this as any) as IValidatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [ - hash, - signerAddress.toLowerCase(), - signature, - ]); + const self = this as any as IValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [hash, + signerAddress.toLowerCase(), + signature + ]); return abiEncodedTransactionData; }, }; - public static async deployFrom0xArtifactAsync( +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, + artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -101,13 +106,15 @@ export class IValidatorContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - return IValidatorContract.deployAsync(bytecode, abi, provider, txDefaults); + const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); + return IValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, ); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, + abiDependencies: { [contractName: string]: ContractAbi }, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -117,13 +124,17 @@ export class IValidatorContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); + [] = BaseContract._formatABIDataItemList( + constructorAbi.inputs, + [], + BaseContract._bigNumberToString, + ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -131,17 +142,18 @@ export class IValidatorContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`IValidator successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new IValidatorContract(txReceipt.contractAddress as string, provider, txDefaults); + const contractInstance = new IValidatorContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); contractInstance.constructorArgs = []; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -171,11 +183,11 @@ export class IValidatorContract extends BaseContract { ] as ContractAbi; return abi; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial) { - super('IValidator', IValidatorContract.ABI(), address, supportedProvider, txDefaults); + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + super('IValidator', IValidatorContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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..4b8ac08133 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts @@ -1,7 +1,7 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract'; +import { BaseContract,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -21,8 +21,10 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; +import * as _ from 'lodash'; // tslint:enable:no-unused-variable + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name @@ -33,7 +35,8 @@ export class IWalletContract extends BaseContract { signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('hash', hash); assert.isString('signature', signature); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -44,8 +47,10 @@ export class IWalletContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as IWalletContract; - const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,bytes)', [hash, signature]); + const self = this as any as IWalletContract; + const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,bytes)', [hash, + signature + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -54,33 +59,35 @@ export class IWalletContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isValidSignature(bytes32,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(hash: string, signature: string): string { + getABIEncodedTransactionData( + hash: string, + signature: string, + ): string { assert.isString('hash', hash); assert.isString('signature', signature); - const self = (this as any) as IWalletContract; - const abiEncodedTransactionData = self._strictEncodeArguments('isValidSignature(bytes32,bytes)', [ - hash, - signature, - ]); + const self = this as any as IWalletContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isValidSignature(bytes32,bytes)', [hash, + signature + ]); return abiEncodedTransactionData; }, }; - public static async deployFrom0xArtifactAsync( +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, + artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -93,13 +100,15 @@ export class IWalletContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - return IWalletContract.deployAsync(bytecode, abi, provider, txDefaults); + const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); + return IWalletContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, ); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, + abiDependencies: { [contractName: string]: ContractAbi }, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -109,13 +118,17 @@ export class IWalletContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); + [] = BaseContract._formatABIDataItemList( + constructorAbi.inputs, + [], + BaseContract._bigNumberToString, + ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -123,17 +136,18 @@ export class IWalletContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`IWallet successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new IWalletContract(txReceipt.contractAddress as string, provider, txDefaults); + const contractInstance = new IWalletContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); contractInstance.constructorArgs = []; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -159,11 +173,11 @@ export class IWalletContract extends BaseContract { ] as ContractAbi; return abi; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial) { - super('IWallet', IWalletContract.ABI(), address, supportedProvider, txDefaults); + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + super('IWallet', IWalletContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 23da203f8b..746cba577e 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 @@ -1,14 +1,11 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { - BaseContract, +import { BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager, - PromiseWithTransactionHash, -} from '@0x/base-contract'; + SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -29,6 +26,7 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; +import * as _ from 'lodash'; // tslint:enable:no-unused-variable export type MultiAssetProxyEventArgs = @@ -57,12 +55,18 @@ export interface MultiAssetProxyAssetProxyRegisteredEventArgs extends DecodedLog assetProxy: string; } + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class MultiAssetProxyContract extends BaseContract { public assetProxies = { - async callAsync(index_0: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + index_0: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -72,8 +76,9 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0]); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0 + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -82,45 +87,54 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('assetProxies(bytes4)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: string): string { + getABIEncodedTransactionData( + index_0: string, + ): string { assert.isString('index_0', index_0); - const self = (this as any) as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0]); + const self = this as any as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0 + ]); return abiEncodedTransactionData; }, }; public addAuthorizedAddress = { - async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.addAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + target: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('target', target); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.addAuthorizedAddress.estimateGasAsync.bind( + self, + target.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -128,41 +142,51 @@ export class MultiAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = (this as any) as MultiAssetProxyContract; - const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + const self = this as any as MultiAssetProxyContract; + const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + target: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('target', target); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + target: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('target', target); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -172,8 +196,9 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -182,24 +207,24 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(target: string): string { + getABIEncodedTransactionData( + target: string, + ): string { assert.isString('target', target); - const self = (this as any) as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [ - target.toLowerCase(), - ]); + const self = this as any as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() + ]); return abiEncodedTransactionData; }, }; @@ -208,7 +233,8 @@ export class MultiAssetProxyContract extends BaseContract { index_0: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -218,8 +244,9 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0]); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0 + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -228,22 +255,24 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: BigNumber): string { + getABIEncodedTransactionData( + index_0: BigNumber, + ): string { assert.isBigNumber('index_0', index_0); - const self = (this as any) as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('authorities(uint256)', [index_0]); + const self = this as any as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('authorities(uint256)', [index_0 + ]); return abiEncodedTransactionData; }, }; @@ -252,7 +281,8 @@ export class MultiAssetProxyContract extends BaseContract { assetProxyId: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('assetProxyId', assetProxyId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -262,8 +292,9 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId]); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -272,45 +303,54 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAssetProxy(bytes4)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(assetProxyId: string): string { + getABIEncodedTransactionData( + assetProxyId: string, + ): string { assert.isString('assetProxyId', assetProxyId); - const self = (this as any) as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId]); + const self = this as any as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId + ]); return abiEncodedTransactionData; }, }; public removeAuthorizedAddress = { - async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + target: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('target', target); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeAuthorizedAddress.estimateGasAsync.bind( + self, + target.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -318,41 +358,51 @@ export class MultiAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = (this as any) as MultiAssetProxyContract; - const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + const self = this as any as MultiAssetProxyContract; + const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + target: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('target', target); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + target: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('target', target); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -362,8 +412,9 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -372,29 +423,33 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(target: string): string { + getABIEncodedTransactionData( + target: string, + ): string { assert.isString('target', target); - const self = (this as any) as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [ - target.toLowerCase(), - ]); + const self = this as any as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public owner = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -403,7 +458,7 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as MultiAssetProxyContract; + const self = this as any as MultiAssetProxyContract; const encodedData = self._strictEncodeArguments('owner()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -413,20 +468,20 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as MultiAssetProxyContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as MultiAssetProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); return abiEncodedTransactionData; }, @@ -435,30 +490,33 @@ export class MultiAssetProxyContract extends BaseContract { async sendTransactionAsync( target: string, index: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), + index + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind( + self, target.toLowerCase(), - index, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(self, target.toLowerCase(), index), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + index + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -467,59 +525,57 @@ export class MultiAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as MultiAssetProxyContract; - const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync( - target.toLowerCase(), - index, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = this as any as MultiAssetProxyContract; + const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync(target.toLowerCase(), + index + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( target: string, index: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target.toLowerCase(), - index, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), + index + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( target: string, index: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('target', target); assert.isBigNumber('index', index); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -530,11 +586,10 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target.toLowerCase(), - index, - ]); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), + index + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -543,31 +598,36 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(target: string, index: BigNumber): string { + getABIEncodedTransactionData( + target: string, + index: BigNumber, + ): string { assert.isString('target', target); assert.isBigNumber('index', index); - const self = (this as any) as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'removeAuthorizedAddressAtIndex(address,uint256)', - [target.toLowerCase(), index], - ); + const self = this as any as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), + index + ]); return abiEncodedTransactionData; }, }; public getProxyId = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -576,7 +636,7 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as MultiAssetProxyContract; + const self = this as any as MultiAssetProxyContract; const encodedData = self._strictEncodeArguments('getProxyId()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -586,20 +646,20 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getProxyId()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as MultiAssetProxyContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as MultiAssetProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('getProxyId()', []); return abiEncodedTransactionData; }, @@ -609,7 +669,8 @@ export class MultiAssetProxyContract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -619,8 +680,9 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase()]); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -629,47 +691,54 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorized(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: string): string { + getABIEncodedTransactionData( + index_0: string, + ): string { assert.isString('index_0', index_0); - const self = (this as any) as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [ - index_0.toLowerCase(), - ]); + const self = this as any as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public registerAssetProxy = { - async sendTransactionAsync(assetProxy: string, txData?: Partial | undefined): Promise { - assert.isString('assetProxy', assetProxy); - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.registerAssetProxy.estimateGasAsync.bind(self, assetProxy.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + assetProxy: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('assetProxy', assetProxy); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.registerAssetProxy.estimateGasAsync.bind( + self, + assetProxy.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( assetProxy: string, @@ -677,45 +746,51 @@ export class MultiAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('assetProxy', assetProxy); - const self = (this as any) as MultiAssetProxyContract; - const txHashPromise = self.registerAssetProxy.sendTransactionAsync(assetProxy.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('assetProxy', assetProxy); + const self = this as any as MultiAssetProxyContract; + const txHashPromise = self.registerAssetProxy.sendTransactionAsync(assetProxy.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(assetProxy: string, txData?: Partial | undefined): Promise { - assert.isString('assetProxy', assetProxy); - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + assetProxy: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('assetProxy', assetProxy); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( assetProxy: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('assetProxy', assetProxy); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -725,8 +800,9 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase()]); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -735,29 +811,33 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(assetProxy: string): string { + getABIEncodedTransactionData( + assetProxy: string, + ): string { assert.isString('assetProxy', assetProxy); - const self = (this as any) as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address)', [ - assetProxy.toLowerCase(), - ]); + const self = this as any as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public getAuthorizedAddresses = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -766,7 +846,7 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as MultiAssetProxyContract; + const self = this as any as MultiAssetProxyContract; const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -776,44 +856,51 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as MultiAssetProxyContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as MultiAssetProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('getAuthorizedAddresses()', []); return abiEncodedTransactionData; }, }; public transferOwnership = { - async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + newOwner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('newOwner', newOwner); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferOwnership.estimateGasAsync.bind( + self, + newOwner.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( newOwner: string, @@ -821,41 +908,51 @@ export class MultiAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('newOwner', newOwner); - const self = (this as any) as MultiAssetProxyContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('newOwner', newOwner); + const self = this as any as MultiAssetProxyContract; + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + newOwner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('newOwner', newOwner); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + newOwner: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -865,8 +962,9 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -875,32 +973,33 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(newOwner: string): string { + getABIEncodedTransactionData( + newOwner: string, + ): string { assert.isString('newOwner', newOwner); - const self = (this as any) as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ - newOwner.toLowerCase(), - ]); + const self = this as any as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); return abiEncodedTransactionData; }, }; - private readonly _subscriptionManager: SubscriptionManager; - public static async deployFrom0xArtifactAsync( +private readonly _subscriptionManager: SubscriptionManager; +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, + artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -913,13 +1012,15 @@ export class MultiAssetProxyContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - return MultiAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults); + const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); + return MultiAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, ); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, + abiDependencies: { [contractName: string]: ContractAbi }, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -929,13 +1030,17 @@ export class MultiAssetProxyContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); + [] = BaseContract._formatABIDataItemList( + constructorAbi.inputs, + [], + BaseContract._bigNumberToString, + ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -943,17 +1048,18 @@ export class MultiAssetProxyContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`MultiAssetProxy successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new MultiAssetProxyContract(txReceipt.contractAddress as string, provider, txDefaults); + const contractInstance = new MultiAssetProxyContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); contractInstance.constructorArgs = []; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -972,7 +1078,7 @@ export class MultiAssetProxyContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -981,12 +1087,13 @@ export class MultiAssetProxyContract extends BaseContract { }, ], name: 'addAuthorizedAddress', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1005,7 +1112,7 @@ export class MultiAssetProxyContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1024,7 +1131,7 @@ export class MultiAssetProxyContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1033,14 +1140,16 @@ export class MultiAssetProxyContract extends BaseContract { }, ], name: 'removeAuthorizedAddress', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'owner', outputs: [ { @@ -1052,7 +1161,7 @@ export class MultiAssetProxyContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1065,14 +1174,16 @@ export class MultiAssetProxyContract extends BaseContract { }, ], name: 'removeAuthorizedAddressAtIndex', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'getProxyId', outputs: [ { @@ -1084,7 +1195,7 @@ export class MultiAssetProxyContract extends BaseContract { stateMutability: 'pure', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1103,7 +1214,7 @@ export class MultiAssetProxyContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1112,14 +1223,16 @@ export class MultiAssetProxyContract extends BaseContract { }, ], name: 'registerAssetProxy', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'getAuthorizedAddresses', outputs: [ { @@ -1131,7 +1244,7 @@ export class MultiAssetProxyContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1140,19 +1253,22 @@ export class MultiAssetProxyContract extends BaseContract { }, ], name: 'transferOwnership', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { - inputs: [], - outputs: [], + { + inputs: [ + ], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'fallback', }, - { + { anonymous: false, inputs: [ { @@ -1167,10 +1283,11 @@ export class MultiAssetProxyContract extends BaseContract { }, ], name: 'AuthorizedAddressAdded', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1185,10 +1302,11 @@ export class MultiAssetProxyContract extends BaseContract { }, ], name: 'AuthorizedAddressRemoved', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1203,7 +1321,8 @@ export class MultiAssetProxyContract extends BaseContract { }, ], name: 'AssetProxyRegistered', - outputs: [], + outputs: [ + ], type: 'event', }, ] as ContractAbi; @@ -1277,15 +1396,15 @@ export class MultiAssetProxyContract extends BaseContract { ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial) { - super('MultiAssetProxy', MultiAssetProxyContract.ABI(), address, supportedProvider, txDefaults); + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + super('MultiAssetProxy', MultiAssetProxyContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( MultiAssetProxyContract.ABI(), this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 bf0e009c32..bd2513638d 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts @@ -1,7 +1,7 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract'; +import { BaseContract,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -21,46 +21,23 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; +import * as _ from 'lodash'; // tslint:enable:no-unused-variable + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class OrderValidatorContract extends BaseContract { public getOrderAndTraderInfo = { async callAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, takerAddress: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise< - [ - { orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }, - { - makerBalance: BigNumber; - makerAllowance: BigNumber; - takerBalance: BigNumber; - takerAllowance: BigNumber; - makerZrxBalance: BigNumber; - makerZrxAllowance: BigNumber; - takerZrxBalance: BigNumber; - takerZrxAllowance: BigNumber; - } - ] + ): Promise<[{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}, {makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}] > { + assert.isString('takerAddress', takerAddress); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -70,11 +47,10 @@ export class OrderValidatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as OrderValidatorContract; - const encodedData = self._strictEncodeArguments( - 'getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', - [order, takerAddress.toLowerCase()], - ); + const self = this as any as OrderValidatorContract; + const encodedData = self._strictEncodeArguments('getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', [order, + takerAddress.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -83,57 +59,27 @@ export class OrderValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', - ); + const abiEncoder = self._lookupAbiEncoder('getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue< - [ - { orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }, - { - makerBalance: BigNumber; - makerAllowance: BigNumber; - takerBalance: BigNumber; - takerAllowance: BigNumber; - makerZrxBalance: BigNumber; - makerZrxAllowance: BigNumber; - takerZrxBalance: BigNumber; - takerZrxAllowance: BigNumber; - } - ] - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<[{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}, {makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}] + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - takerAddress: string, - ): string { + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + takerAddress: string, + ): string { + assert.isString('takerAddress', takerAddress); - const self = (this as any) as OrderValidatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', - [order, takerAddress.toLowerCase()], - ); + const self = this as any as OrderValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', [order, + takerAddress.toLowerCase() + ]); return abiEncodedTransactionData; }, }; @@ -143,7 +89,8 @@ export class OrderValidatorContract extends BaseContract { assetData: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<[BigNumber, BigNumber]> { + ): Promise<[BigNumber, BigNumber] + > { assert.isString('target', target); assert.isString('assetData', assetData); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -154,11 +101,10 @@ export class OrderValidatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as OrderValidatorContract; - const encodedData = self._strictEncodeArguments('getBalanceAndAllowance(address,bytes)', [ - target.toLowerCase(), - assetData, - ]); + const self = this as any as OrderValidatorContract; + const encodedData = self._strictEncodeArguments('getBalanceAndAllowance(address,bytes)', [target.toLowerCase(), + assetData + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -167,62 +113,37 @@ export class OrderValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getBalanceAndAllowance(address,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<[BigNumber, BigNumber]>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<[BigNumber, BigNumber] + >(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(target: string, assetData: string): string { + getABIEncodedTransactionData( + target: string, + assetData: string, + ): string { assert.isString('target', target); assert.isString('assetData', assetData); - const self = (this as any) as OrderValidatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getBalanceAndAllowance(address,bytes)', [ - target.toLowerCase(), - assetData, - ]); + const self = this as any as OrderValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getBalanceAndAllowance(address,bytes)', [target.toLowerCase(), + assetData + ]); return abiEncodedTransactionData; }, }; public getOrdersAndTradersInfo = { async callAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAddresses: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise< - [ - Array<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }>, - Array<{ - makerBalance: BigNumber; - makerAllowance: BigNumber; - takerBalance: BigNumber; - takerAllowance: BigNumber; - makerZrxBalance: BigNumber; - makerZrxAllowance: BigNumber; - takerZrxBalance: BigNumber; - takerZrxAllowance: BigNumber; - }> - ] + ): Promise<[Array<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}>, Array<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}>] > { assert.isArray('orders', orders); assert.isArray('takerAddresses', takerAddresses); @@ -234,11 +155,10 @@ export class OrderValidatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as OrderValidatorContract; - const encodedData = self._strictEncodeArguments( - 'getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', - [orders, takerAddresses], - ); + const self = this as any as OrderValidatorContract; + const encodedData = self._strictEncodeArguments('getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', [orders, + takerAddresses + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -247,91 +167,37 @@ export class OrderValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', - ); + const abiEncoder = self._lookupAbiEncoder('getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue< - [ - Array<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }>, - Array<{ - makerBalance: BigNumber; - makerAllowance: BigNumber; - takerBalance: BigNumber; - takerAllowance: BigNumber; - makerZrxBalance: BigNumber; - makerZrxAllowance: BigNumber; - takerZrxBalance: BigNumber; - takerZrxAllowance: BigNumber; - }> - ] - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<[Array<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}>, Array<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}>] + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, - takerAddresses: string[], - ): string { + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + takerAddresses: string[], + ): string { assert.isArray('orders', orders); assert.isArray('takerAddresses', takerAddresses); - const self = (this as any) as OrderValidatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', - [orders, takerAddresses], - ); + const self = this as any as OrderValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', [orders, + takerAddresses + ]); return abiEncodedTransactionData; }, }; public getTradersInfo = { async callAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAddresses: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise< - Array<{ - makerBalance: BigNumber; - makerAllowance: BigNumber; - takerBalance: BigNumber; - takerAllowance: BigNumber; - makerZrxBalance: BigNumber; - makerZrxAllowance: BigNumber; - takerZrxBalance: BigNumber; - takerZrxAllowance: BigNumber; - }> + ): Promise > { assert.isArray('orders', orders); assert.isArray('takerAddresses', takerAddresses); @@ -343,11 +209,10 @@ export class OrderValidatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as OrderValidatorContract; - const encodedData = self._strictEncodeArguments( - 'getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', - [orders, takerAddresses], - ); + const self = this as any as OrderValidatorContract; + const encodedData = self._strictEncodeArguments('getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', [orders, + takerAddresses + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -356,55 +221,27 @@ export class OrderValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', - ); + const abiEncoder = self._lookupAbiEncoder('getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue< - Array<{ - makerBalance: BigNumber; - makerAllowance: BigNumber; - takerBalance: BigNumber; - takerAllowance: BigNumber; - makerZrxBalance: BigNumber; - makerZrxAllowance: BigNumber; - takerZrxBalance: BigNumber; - takerZrxAllowance: BigNumber; - }> - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, - takerAddresses: string[], - ): string { + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + takerAddresses: string[], + ): string { assert.isArray('orders', orders); assert.isArray('takerAddresses', takerAddresses); - const self = (this as any) as OrderValidatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', - [orders, takerAddresses], - ); + const self = this as any as OrderValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', [orders, + takerAddresses + ]); return abiEncodedTransactionData; }, }; @@ -414,7 +251,8 @@ export class OrderValidatorContract extends BaseContract { tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('token', token); assert.isBigNumber('tokenId', tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -425,11 +263,10 @@ export class OrderValidatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as OrderValidatorContract; - const encodedData = self._strictEncodeArguments('getERC721TokenOwner(address,uint256)', [ - token.toLowerCase(), - tokenId, - ]); + const self = this as any as OrderValidatorContract; + const encodedData = self._strictEncodeArguments('getERC721TokenOwner(address,uint256)', [token.toLowerCase(), + tokenId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -438,26 +275,27 @@ export class OrderValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getERC721TokenOwner(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(token: string, tokenId: BigNumber): string { + getABIEncodedTransactionData( + token: string, + tokenId: BigNumber, + ): string { assert.isString('token', token); assert.isBigNumber('tokenId', tokenId); - const self = (this as any) as OrderValidatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getERC721TokenOwner(address,uint256)', [ - token.toLowerCase(), - tokenId, - ]); + const self = this as any as OrderValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getERC721TokenOwner(address,uint256)', [token.toLowerCase(), + tokenId + ]); return abiEncodedTransactionData; }, }; @@ -467,7 +305,8 @@ export class OrderValidatorContract extends BaseContract { assetData: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<[BigNumber[], BigNumber[]]> { + ): Promise<[BigNumber[], BigNumber[]] + > { assert.isString('target', target); assert.isArray('assetData', assetData); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -478,11 +317,10 @@ export class OrderValidatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as OrderValidatorContract; - const encodedData = self._strictEncodeArguments('getBalancesAndAllowances(address,bytes[])', [ - target.toLowerCase(), - assetData, - ]); + const self = this as any as OrderValidatorContract; + const encodedData = self._strictEncodeArguments('getBalancesAndAllowances(address,bytes[])', [target.toLowerCase(), + assetData + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -491,58 +329,39 @@ export class OrderValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getBalancesAndAllowances(address,bytes[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<[BigNumber[], BigNumber[]]>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<[BigNumber[], BigNumber[]] + >(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(target: string, assetData: string[]): string { + getABIEncodedTransactionData( + target: string, + assetData: string[], + ): string { assert.isString('target', target); assert.isArray('assetData', assetData); - const self = (this as any) as OrderValidatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getBalancesAndAllowances(address,bytes[])', [ - target.toLowerCase(), - assetData, - ]); + const self = this as any as OrderValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getBalancesAndAllowances(address,bytes[])', [target.toLowerCase(), + assetData + ]); return abiEncodedTransactionData; }, }; public getTraderInfo = { async callAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, takerAddress: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{ - makerBalance: BigNumber; - makerAllowance: BigNumber; - takerBalance: BigNumber; - takerAllowance: BigNumber; - makerZrxBalance: BigNumber; - makerZrxAllowance: BigNumber; - takerZrxBalance: BigNumber; - takerZrxAllowance: BigNumber; - }> { + ): Promise<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber} + > { + assert.isString('takerAddress', takerAddress); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -552,11 +371,10 @@ export class OrderValidatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as OrderValidatorContract; - const encodedData = self._strictEncodeArguments( - 'getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', - [order, takerAddress.toLowerCase()], - ); + const self = this as any as OrderValidatorContract; + const encodedData = self._strictEncodeArguments('getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', [order, + takerAddress.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -565,61 +383,37 @@ export class OrderValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', - ); + const abiEncoder = self._lookupAbiEncoder('getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ - makerBalance: BigNumber; - makerAllowance: BigNumber; - takerBalance: BigNumber; - takerAllowance: BigNumber; - makerZrxBalance: BigNumber; - makerZrxAllowance: BigNumber; - takerZrxBalance: BigNumber; - takerZrxAllowance: BigNumber; - }>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber} + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - takerAddress: string, - ): string { + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + takerAddress: string, + ): string { + assert.isString('takerAddress', takerAddress); - const self = (this as any) as OrderValidatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', - [order, takerAddress.toLowerCase()], - ); + const self = this as any as OrderValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', [order, + takerAddress.toLowerCase() + ]); return abiEncodedTransactionData; }, }; - public static async deployFrom0xArtifactAsync( +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - _exchange: string, - _zrxAssetData: string, + artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + _exchange: string, + _zrxAssetData: string, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -632,15 +426,19 @@ export class OrderValidatorContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - return OrderValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, _exchange, _zrxAssetData); + const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); + return OrderValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, _exchange, +_zrxAssetData +); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, - _exchange: string, - _zrxAssetData: string, + abiDependencies: { [contractName: string]: ContractAbi }, + _exchange: string, + _zrxAssetData: string, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -650,17 +448,23 @@ export class OrderValidatorContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_exchange, _zrxAssetData] = BaseContract._formatABIDataItemList( + [_exchange, +_zrxAssetData +] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [_exchange, _zrxAssetData], + [_exchange, +_zrxAssetData +], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_exchange, _zrxAssetData]); + const txData = deployInfo.encode(bytecode, [_exchange, +_zrxAssetData +]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -668,17 +472,20 @@ export class OrderValidatorContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`OrderValidator successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new OrderValidatorContract(txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = [_exchange, _zrxAssetData]; + const contractInstance = new OrderValidatorContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); + contractInstance.constructorArgs = [_exchange, +_zrxAssetData +]; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -733,7 +540,7 @@ export class OrderValidatorContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'takerAddress', @@ -758,7 +565,7 @@ export class OrderValidatorContract extends BaseContract { name: 'orderTakerAssetFilledAmount', type: 'uint256', }, - ], + ] }, { name: 'traderInfo', @@ -796,14 +603,14 @@ export class OrderValidatorContract extends BaseContract { name: 'takerZrxAllowance', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -830,7 +637,7 @@ export class OrderValidatorContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -885,7 +692,7 @@ export class OrderValidatorContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'takerAddresses', @@ -910,7 +717,7 @@ export class OrderValidatorContract extends BaseContract { name: 'orderTakerAssetFilledAmount', type: 'uint256', }, - ], + ] }, { name: 'tradersInfo', @@ -948,14 +755,14 @@ export class OrderValidatorContract extends BaseContract { name: 'takerZrxAllowance', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1010,7 +817,7 @@ export class OrderValidatorContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'takerAddresses', @@ -1055,14 +862,14 @@ export class OrderValidatorContract extends BaseContract { name: 'takerZrxAllowance', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1085,7 +892,7 @@ export class OrderValidatorContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1112,7 +919,7 @@ export class OrderValidatorContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1167,7 +974,7 @@ export class OrderValidatorContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'takerAddress', @@ -1212,14 +1019,14 @@ export class OrderValidatorContract extends BaseContract { name: 'takerZrxAllowance', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'view', type: 'function', }, - { + { inputs: [ { name: '_exchange', @@ -1230,7 +1037,8 @@ export class OrderValidatorContract extends BaseContract { type: 'bytes', }, ], - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'constructor', @@ -1238,11 +1046,11 @@ export class OrderValidatorContract extends BaseContract { ] as ContractAbi; return abi; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial) { - super('OrderValidator', OrderValidatorContract.ABI(), address, supportedProvider, txDefaults); + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + super('OrderValidator', OrderValidatorContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts b/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts index 51de23f67f..dcb129edf7 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts @@ -1,14 +1,11 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { - BaseContract, +import { BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager, - PromiseWithTransactionHash, -} from '@0x/base-contract'; + SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -29,6 +26,7 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; +import * as _ from 'lodash'; // tslint:enable:no-unused-variable export type WETH9EventArgs = @@ -66,12 +64,17 @@ export interface WETH9WithdrawalEventArgs extends DecodedLogArgs { _value: BigNumber; } + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class WETH9Contract extends BaseContract { public name = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -80,7 +83,7 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as WETH9Contract; + const self = this as any as WETH9Contract; const encodedData = self._strictEncodeArguments('name()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -90,45 +93,55 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('name()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as WETH9Contract; + getABIEncodedTransactionData( + ): string { + const self = this as any as WETH9Contract; const abiEncodedTransactionData = self._strictEncodeArguments('name()', []); return abiEncodedTransactionData; }, }; public approve = { - async sendTransactionAsync(guy: string, wad: BigNumber, txData?: Partial | undefined): Promise { - assert.isString('guy', guy); - assert.isBigNumber('wad', wad); - const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy.toLowerCase(), wad]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind(self, guy.toLowerCase(), wad), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + guy: string, + wad: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isString('guy', guy); + assert.isBigNumber('wad', wad); + const self = this as any as WETH9Contract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy.toLowerCase(), + wad + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.approve.estimateGasAsync.bind( + self, + guy.toLowerCase(), + wad + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( guy: string, @@ -137,48 +150,57 @@ export class WETH9Contract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('guy', guy); - assert.isBigNumber('wad', wad); - const self = (this as any) as WETH9Contract; - const txHashPromise = self.approve.sendTransactionAsync(guy.toLowerCase(), wad, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('guy', guy); + assert.isBigNumber('wad', wad); + const self = this as any as WETH9Contract; + const txHashPromise = self.approve.sendTransactionAsync(guy.toLowerCase(), + wad + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(guy: string, wad: BigNumber, txData?: Partial | undefined): Promise { - assert.isString('guy', guy); - assert.isBigNumber('wad', wad); - const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy.toLowerCase(), wad]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + guy: string, + wad: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isString('guy', guy); + assert.isBigNumber('wad', wad); + const self = this as any as WETH9Contract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy.toLowerCase(), + wad + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( guy: string, wad: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('guy', guy); assert.isBigNumber('wad', wad); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -189,8 +211,10 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy.toLowerCase(), wad]); + const self = this as any as WETH9Contract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy.toLowerCase(), + wad + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -199,31 +223,36 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(guy: string, wad: BigNumber): string { + getABIEncodedTransactionData( + guy: string, + wad: BigNumber, + ): string { assert.isString('guy', guy); assert.isBigNumber('wad', wad); - const self = (this as any) as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [ - guy.toLowerCase(), - wad, - ]); + const self = this as any as WETH9Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [guy.toLowerCase(), + wad + ]); return abiEncodedTransactionData; }, }; public totalSupply = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -232,7 +261,7 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as WETH9Contract; + const self = this as any as WETH9Contract; const encodedData = self._strictEncodeArguments('totalSupply()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -242,20 +271,20 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('totalSupply()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as WETH9Contract; + getABIEncodedTransactionData( + ): string { + const self = this as any as WETH9Contract; const abiEncodedTransactionData = self._strictEncodeArguments('totalSupply()', []); return abiEncodedTransactionData; }, @@ -265,32 +294,36 @@ export class WETH9Contract extends BaseContract { src: string, dst: string, wad: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('src', src); - assert.isString('dst', dst); - assert.isBigNumber('wad', wad); - const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + assert.isString('src', src); + assert.isString('dst', dst); + assert.isBigNumber('wad', wad); + const self = this as any as WETH9Contract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [src.toLowerCase(), + dst.toLowerCase(), + wad + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferFrom.estimateGasAsync.bind( + self, src.toLowerCase(), dst.toLowerCase(), - wad, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind(self, src.toLowerCase(), dst.toLowerCase(), wad), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + wad + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( src: string, @@ -300,27 +333,25 @@ export class WETH9Contract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('src', src); - assert.isString('dst', dst); - assert.isBigNumber('wad', wad); - const self = (this as any) as WETH9Contract; - const txHashPromise = self.transferFrom.sendTransactionAsync( - src.toLowerCase(), - dst.toLowerCase(), - wad, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('src', src); + assert.isString('dst', dst); + assert.isBigNumber('wad', wad); + const self = this as any as WETH9Contract; + const txHashPromise = self.transferFrom.sendTransactionAsync(src.toLowerCase(), + dst.toLowerCase(), + wad + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( src: string, @@ -328,29 +359,28 @@ export class WETH9Contract extends BaseContract { wad: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('src', src); - assert.isString('dst', dst); - assert.isBigNumber('wad', wad); - const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - src.toLowerCase(), - dst.toLowerCase(), - wad, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('src', src); + assert.isString('dst', dst); + assert.isBigNumber('wad', wad); + const self = this as any as WETH9Contract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [src.toLowerCase(), + dst.toLowerCase(), + wad + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( src: string, @@ -358,7 +388,8 @@ export class WETH9Contract extends BaseContract { wad: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('src', src); assert.isString('dst', dst); assert.isBigNumber('wad', wad); @@ -370,12 +401,11 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - src.toLowerCase(), - dst.toLowerCase(), - wad, - ]); + const self = this as any as WETH9Contract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [src.toLowerCase(), + dst.toLowerCase(), + wad + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -384,51 +414,60 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(src: string, dst: string, wad: BigNumber): string { + getABIEncodedTransactionData( + src: string, + dst: string, + wad: BigNumber, + ): string { assert.isString('src', src); assert.isString('dst', dst); assert.isBigNumber('wad', wad); - const self = (this as any) as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - src.toLowerCase(), - dst.toLowerCase(), - wad, - ]); + const self = this as any as WETH9Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [src.toLowerCase(), + dst.toLowerCase(), + wad + ]); return abiEncodedTransactionData; }, }; public withdraw = { - async sendTransactionAsync(wad: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('wad', wad); - const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.withdraw.estimateGasAsync.bind(self, wad), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + wad: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('wad', wad); + const self = this as any as WETH9Contract; + const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.withdraw.estimateGasAsync.bind( + self, + wad + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( wad: BigNumber, @@ -436,41 +475,51 @@ export class WETH9Contract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('wad', wad); - const self = (this as any) as WETH9Contract; - const txHashPromise = self.withdraw.sendTransactionAsync(wad, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('wad', wad); + const self = this as any as WETH9Contract; + const txHashPromise = self.withdraw.sendTransactionAsync(wad + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(wad: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('wad', wad); - const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + wad: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('wad', wad); + const self = this as any as WETH9Contract; + const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(wad: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + wad: BigNumber, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isBigNumber('wad', wad); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -480,8 +529,9 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad]); + const self = this as any as WETH9Contract; + const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -490,27 +540,33 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('withdraw(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(wad: BigNumber): string { + getABIEncodedTransactionData( + wad: BigNumber, + ): string { assert.isBigNumber('wad', wad); - const self = (this as any) as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('withdraw(uint256)', [wad]); + const self = this as any as WETH9Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('withdraw(uint256)', [wad + ]); return abiEncodedTransactionData; }, }; public decimals = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -519,7 +575,7 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as WETH9Contract; + const self = this as any as WETH9Contract; const encodedData = self._strictEncodeArguments('decimals()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -529,20 +585,20 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('decimals()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as WETH9Contract; + getABIEncodedTransactionData( + ): string { + const self = this as any as WETH9Contract; const abiEncodedTransactionData = self._strictEncodeArguments('decimals()', []); return abiEncodedTransactionData; }, @@ -552,7 +608,8 @@ export class WETH9Contract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -562,8 +619,9 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [index_0.toLowerCase()]); + const self = this as any as WETH9Contract; + const encodedData = self._strictEncodeArguments('balanceOf(address)', [index_0.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -572,29 +630,33 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: string): string { + getABIEncodedTransactionData( + index_0: string, + ): string { assert.isString('index_0', index_0); - const self = (this as any) as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [ - index_0.toLowerCase(), - ]); + const self = this as any as WETH9Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [index_0.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public symbol = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -603,7 +665,7 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as WETH9Contract; + const self = this as any as WETH9Contract; const encodedData = self._strictEncodeArguments('symbol()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -613,45 +675,55 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('symbol()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as WETH9Contract; + getABIEncodedTransactionData( + ): string { + const self = this as any as WETH9Contract; const abiEncodedTransactionData = self._strictEncodeArguments('symbol()', []); return abiEncodedTransactionData; }, }; public transfer = { - async sendTransactionAsync(dst: string, wad: BigNumber, txData?: Partial | undefined): Promise { - assert.isString('dst', dst); - assert.isBigNumber('wad', wad); - const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst.toLowerCase(), wad]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transfer.estimateGasAsync.bind(self, dst.toLowerCase(), wad), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + dst: string, + wad: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isString('dst', dst); + assert.isBigNumber('wad', wad); + const self = this as any as WETH9Contract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst.toLowerCase(), + wad + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transfer.estimateGasAsync.bind( + self, + dst.toLowerCase(), + wad + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( dst: string, @@ -660,48 +732,57 @@ export class WETH9Contract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('dst', dst); - assert.isBigNumber('wad', wad); - const self = (this as any) as WETH9Contract; - const txHashPromise = self.transfer.sendTransactionAsync(dst.toLowerCase(), wad, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('dst', dst); + assert.isBigNumber('wad', wad); + const self = this as any as WETH9Contract; + const txHashPromise = self.transfer.sendTransactionAsync(dst.toLowerCase(), + wad + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(dst: string, wad: BigNumber, txData?: Partial | undefined): Promise { - assert.isString('dst', dst); - assert.isBigNumber('wad', wad); - const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst.toLowerCase(), wad]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + dst: string, + wad: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isString('dst', dst); + assert.isBigNumber('wad', wad); + const self = this as any as WETH9Contract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst.toLowerCase(), + wad + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( dst: string, wad: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('dst', dst); assert.isBigNumber('wad', wad); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -712,8 +793,10 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst.toLowerCase(), wad]); + const self = this as any as WETH9Contract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst.toLowerCase(), + wad + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -722,87 +805,98 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(dst: string, wad: BigNumber): string { + getABIEncodedTransactionData( + dst: string, + wad: BigNumber, + ): string { assert.isString('dst', dst); assert.isBigNumber('wad', wad); - const self = (this as any) as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [ - dst.toLowerCase(), - wad, - ]); + const self = this as any as WETH9Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [dst.toLowerCase(), + wad + ]); return abiEncodedTransactionData; }, }; public deposit = { - async sendTransactionAsync(txData?: Partial | undefined): Promise { - const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('deposit()', []); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.deposit.estimateGasAsync.bind(self), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + txData?: Partial | undefined, + ): Promise { + const self = this as any as WETH9Contract; + const encodedData = self._strictEncodeArguments('deposit()', []); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.deposit.estimateGasAsync.bind( + self, + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - const self = (this as any) as WETH9Contract; - const txHashPromise = self.deposit.sendTransactionAsync(txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + const self = this as any as WETH9Contract; + const txHashPromise = self.deposit.sendTransactionAsync(txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(txData?: Partial | undefined): Promise { - const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('deposit()', []); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + txData?: Partial | undefined, + ): Promise { + const self = this as any as WETH9Contract; + const encodedData = self._strictEncodeArguments('deposit()', []); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -811,7 +905,7 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as WETH9Contract; + const self = this as any as WETH9Contract; const encodedData = self._strictEncodeArguments('deposit()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -821,20 +915,20 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('deposit()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as WETH9Contract; + getABIEncodedTransactionData( + ): string { + const self = this as any as WETH9Contract; const abiEncodedTransactionData = self._strictEncodeArguments('deposit()', []); return abiEncodedTransactionData; }, @@ -845,7 +939,8 @@ export class WETH9Contract extends BaseContract { index_1: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.isString('index_1', index_1); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -856,11 +951,10 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('allowance(address,address)', [ - index_0.toLowerCase(), - index_1.toLowerCase(), - ]); + const self = this as any as WETH9Contract; + const encodedData = self._strictEncodeArguments('allowance(address,address)', [index_0.toLowerCase(), + index_1.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -869,34 +963,36 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: string, index_1: string): string { + getABIEncodedTransactionData( + index_0: string, + index_1: string, + ): string { assert.isString('index_0', index_0); assert.isString('index_1', index_1); - const self = (this as any) as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [ - index_0.toLowerCase(), - index_1.toLowerCase(), - ]); + const self = this as any as WETH9Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [index_0.toLowerCase(), + index_1.toLowerCase() + ]); return abiEncodedTransactionData; }, }; - private readonly _subscriptionManager: SubscriptionManager; - public static async deployFrom0xArtifactAsync( +private readonly _subscriptionManager: SubscriptionManager; +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, + artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -909,13 +1005,15 @@ export class WETH9Contract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - return WETH9Contract.deployAsync(bytecode, abi, provider, txDefaults); + const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); + return WETH9Contract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, ); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, + abiDependencies: { [contractName: string]: ContractAbi }, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -925,13 +1023,17 @@ export class WETH9Contract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); + [] = BaseContract._formatABIDataItemList( + constructorAbi.inputs, + [], + BaseContract._bigNumberToString, + ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -939,19 +1041,21 @@ export class WETH9Contract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`WETH9 successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new WETH9Contract(txReceipt.contractAddress as string, provider, txDefaults); + const contractInstance = new WETH9Contract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); contractInstance.constructorArgs = []; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'name', outputs: [ { @@ -963,7 +1067,7 @@ export class WETH9Contract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -986,9 +1090,10 @@ export class WETH9Contract extends BaseContract { stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'totalSupply', outputs: [ { @@ -1000,7 +1105,7 @@ export class WETH9Contract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1027,7 +1132,7 @@ export class WETH9Contract extends BaseContract { stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1036,14 +1141,16 @@ export class WETH9Contract extends BaseContract { }, ], name: 'withdraw', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'decimals', outputs: [ { @@ -1055,7 +1162,7 @@ export class WETH9Contract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1074,9 +1181,10 @@ export class WETH9Contract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'symbol', outputs: [ { @@ -1088,7 +1196,7 @@ export class WETH9Contract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1111,16 +1219,18 @@ export class WETH9Contract extends BaseContract { stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, - inputs: [], + inputs: [ + ], name: 'deposit', - outputs: [], + outputs: [ + ], payable: true, stateMutability: 'payable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1143,14 +1253,16 @@ export class WETH9Contract extends BaseContract { stateMutability: 'view', type: 'function', }, - { - inputs: [], - outputs: [], + { + inputs: [ + ], + outputs: [ + ], payable: true, stateMutability: 'payable', type: 'fallback', }, - { + { anonymous: false, inputs: [ { @@ -1170,10 +1282,11 @@ export class WETH9Contract extends BaseContract { }, ], name: 'Approval', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1193,10 +1306,11 @@ export class WETH9Contract extends BaseContract { }, ], name: 'Transfer', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1211,10 +1325,11 @@ export class WETH9Contract extends BaseContract { }, ], name: 'Deposit', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1229,7 +1344,8 @@ export class WETH9Contract extends BaseContract { }, ], name: 'Withdrawal', - outputs: [], + outputs: [ + ], type: 'event', }, ] as ContractAbi; @@ -1303,15 +1419,15 @@ export class WETH9Contract extends BaseContract { ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial) { - super('WETH9', WETH9Contract.ABI(), address, supportedProvider, txDefaults); + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + super('WETH9', WETH9Contract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( WETH9Contract.ABI(), this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 b0d5ff3df7..90feb73946 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts @@ -1,14 +1,11 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { - BaseContract, +import { BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager, - PromiseWithTransactionHash, -} from '@0x/base-contract'; + SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -29,9 +26,12 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; +import * as _ from 'lodash'; // tslint:enable:no-unused-variable -export type ZRXTokenEventArgs = ZRXTokenTransferEventArgs | ZRXTokenApprovalEventArgs; +export type ZRXTokenEventArgs = + | ZRXTokenTransferEventArgs + | ZRXTokenApprovalEventArgs; export enum ZRXTokenEvents { Transfer = 'Transfer', @@ -50,12 +50,17 @@ export interface ZRXTokenApprovalEventArgs extends DecodedLogArgs { _value: BigNumber; } + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class ZRXTokenContract extends BaseContract { public name = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -64,7 +69,7 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ZRXTokenContract; + const self = this as any as ZRXTokenContract; const encodedData = self._strictEncodeArguments('name()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -74,20 +79,20 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('name()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as ZRXTokenContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as ZRXTokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('name()', []); return abiEncodedTransactionData; }, @@ -96,30 +101,33 @@ export class ZRXTokenContract extends BaseContract { async sendTransactionAsync( _spender: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = (this as any) as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = this as any as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.approve.estimateGasAsync.bind( + self, _spender.toLowerCase(), - _value, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind(self, _spender.toLowerCase(), _value), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _value + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _spender: string, @@ -128,55 +136,57 @@ export class ZRXTokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = (this as any) as ZRXTokenContract; - const txHashPromise = self.approve.sendTransactionAsync(_spender.toLowerCase(), _value, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = this as any as ZRXTokenContract; + const txHashPromise = self.approve.sendTransactionAsync(_spender.toLowerCase(), + _value + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _spender: string, _value: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = (this as any) as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ - _spender.toLowerCase(), - _value, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = this as any as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _spender: string, _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -187,11 +197,10 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ - _spender.toLowerCase(), - _value, - ]); + const self = this as any as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), + _value + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -200,31 +209,36 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_spender: string, _value: BigNumber): string { + getABIEncodedTransactionData( + _spender: string, + _value: BigNumber, + ): string { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); - const self = (this as any) as ZRXTokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [ - _spender.toLowerCase(), - _value, - ]); + const self = this as any as ZRXTokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), + _value + ]); return abiEncodedTransactionData; }, }; public totalSupply = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -233,7 +247,7 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ZRXTokenContract; + const self = this as any as ZRXTokenContract; const encodedData = self._strictEncodeArguments('totalSupply()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -243,20 +257,20 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('totalSupply()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as ZRXTokenContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as ZRXTokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('totalSupply()', []); return abiEncodedTransactionData; }, @@ -266,32 +280,36 @@ export class ZRXTokenContract extends BaseContract { _from: string, _to: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferFrom.estimateGasAsync.bind( + self, _from.toLowerCase(), _to.toLowerCase(), - _value, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _value), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _value + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -301,27 +319,25 @@ export class ZRXTokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as ZRXTokenContract; - const txHashPromise = self.transferFrom.sendTransactionAsync( - _from.toLowerCase(), - _to.toLowerCase(), - _value, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as ZRXTokenContract; + const txHashPromise = self.transferFrom.sendTransactionAsync(_from.toLowerCase(), + _to.toLowerCase(), + _value + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -329,29 +345,28 @@ export class ZRXTokenContract extends BaseContract { _value: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _value, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -359,7 +374,8 @@ export class ZRXTokenContract extends BaseContract { _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_value', _value); @@ -371,12 +387,11 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _value, - ]); + const self = this as any as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _value + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -385,33 +400,39 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_from: string, _to: string, _value: BigNumber): string { + getABIEncodedTransactionData( + _from: string, + _to: string, + _value: BigNumber, + ): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_value', _value); - const self = (this as any) as ZRXTokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _value, - ]); + const self = this as any as ZRXTokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _value + ]); return abiEncodedTransactionData; }, }; public decimals = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -420,7 +441,7 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ZRXTokenContract; + const self = this as any as ZRXTokenContract; const encodedData = self._strictEncodeArguments('decimals()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -430,20 +451,20 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('decimals()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as ZRXTokenContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as ZRXTokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('decimals()', []); return abiEncodedTransactionData; }, @@ -453,7 +474,8 @@ export class ZRXTokenContract extends BaseContract { _owner: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -463,8 +485,9 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); + const self = this as any as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -473,27 +496,33 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_owner: string): string { + getABIEncodedTransactionData( + _owner: string, + ): string { assert.isString('_owner', _owner); - const self = (this as any) as ZRXTokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); + const self = this as any as ZRXTokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public symbol = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -502,7 +531,7 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ZRXTokenContract; + const self = this as any as ZRXTokenContract; const encodedData = self._strictEncodeArguments('symbol()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -512,20 +541,20 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('symbol()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as ZRXTokenContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as ZRXTokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('symbol()', []); return abiEncodedTransactionData; }, @@ -534,27 +563,33 @@ export class ZRXTokenContract extends BaseContract { async sendTransactionAsync( _to: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transfer.estimateGasAsync.bind(self, _to.toLowerCase(), _value), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transfer.estimateGasAsync.bind( + self, + _to.toLowerCase(), + _value + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _to: string, @@ -563,48 +598,57 @@ export class ZRXTokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as ZRXTokenContract; - const txHashPromise = self.transfer.sendTransactionAsync(_to.toLowerCase(), _value, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as ZRXTokenContract; + const txHashPromise = self.transfer.sendTransactionAsync(_to.toLowerCase(), + _value + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(_to: string, _value: BigNumber, txData?: Partial | undefined): Promise { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + _to: string, + _value: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _to: string, _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_to', _to); assert.isBigNumber('_value', _value); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -615,8 +659,10 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); + const self = this as any as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), + _value + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -625,26 +671,27 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_to: string, _value: BigNumber): string { + getABIEncodedTransactionData( + _to: string, + _value: BigNumber, + ): string { assert.isString('_to', _to); assert.isBigNumber('_value', _value); - const self = (this as any) as ZRXTokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [ - _to.toLowerCase(), - _value, - ]); + const self = this as any as ZRXTokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), + _value + ]); return abiEncodedTransactionData; }, }; @@ -654,7 +701,8 @@ export class ZRXTokenContract extends BaseContract { _spender: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.isString('_spender', _spender); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -665,11 +713,10 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('allowance(address,address)', [ - _owner.toLowerCase(), - _spender.toLowerCase(), - ]); + const self = this as any as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('allowance(address,address)', [_owner.toLowerCase(), + _spender.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -678,34 +725,36 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_owner: string, _spender: string): string { + getABIEncodedTransactionData( + _owner: string, + _spender: string, + ): string { assert.isString('_owner', _owner); assert.isString('_spender', _spender); - const self = (this as any) as ZRXTokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [ - _owner.toLowerCase(), - _spender.toLowerCase(), - ]); + const self = this as any as ZRXTokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [_owner.toLowerCase(), + _spender.toLowerCase() + ]); return abiEncodedTransactionData; }, }; - private readonly _subscriptionManager: SubscriptionManager; - public static async deployFrom0xArtifactAsync( +private readonly _subscriptionManager: SubscriptionManager; +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, + artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -718,13 +767,15 @@ export class ZRXTokenContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - return ZRXTokenContract.deployAsync(bytecode, abi, provider, txDefaults); + const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); + return ZRXTokenContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, ); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, + abiDependencies: { [contractName: string]: ContractAbi }, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -734,13 +785,17 @@ export class ZRXTokenContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); + [] = BaseContract._formatABIDataItemList( + constructorAbi.inputs, + [], + BaseContract._bigNumberToString, + ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -748,19 +803,21 @@ export class ZRXTokenContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`ZRXToken successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ZRXTokenContract(txReceipt.contractAddress as string, provider, txDefaults); + const contractInstance = new ZRXTokenContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); contractInstance.constructorArgs = []; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'name', outputs: [ { @@ -771,7 +828,7 @@ export class ZRXTokenContract extends BaseContract { payable: false, type: 'function', }, - { + { constant: false, inputs: [ { @@ -793,9 +850,10 @@ export class ZRXTokenContract extends BaseContract { payable: false, type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'totalSupply', outputs: [ { @@ -806,7 +864,7 @@ export class ZRXTokenContract extends BaseContract { payable: false, type: 'function', }, - { + { constant: false, inputs: [ { @@ -832,9 +890,10 @@ export class ZRXTokenContract extends BaseContract { payable: false, type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'decimals', outputs: [ { @@ -845,7 +904,7 @@ export class ZRXTokenContract extends BaseContract { payable: false, type: 'function', }, - { + { constant: true, inputs: [ { @@ -863,9 +922,10 @@ export class ZRXTokenContract extends BaseContract { payable: false, type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'symbol', outputs: [ { @@ -876,7 +936,7 @@ export class ZRXTokenContract extends BaseContract { payable: false, type: 'function', }, - { + { constant: false, inputs: [ { @@ -898,7 +958,7 @@ export class ZRXTokenContract extends BaseContract { payable: false, type: 'function', }, - { + { constant: true, inputs: [ { @@ -920,13 +980,15 @@ export class ZRXTokenContract extends BaseContract { payable: false, type: 'function', }, - { - inputs: [], - outputs: [], + { + inputs: [ + ], + outputs: [ + ], payable: false, type: 'constructor', }, - { + { anonymous: false, inputs: [ { @@ -946,10 +1008,11 @@ export class ZRXTokenContract extends BaseContract { }, ], name: 'Transfer', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -969,7 +1032,8 @@ export class ZRXTokenContract extends BaseContract { }, ], name: 'Approval', - outputs: [], + outputs: [ + ], type: 'event', }, ] as ContractAbi; @@ -1043,15 +1107,15 @@ export class ZRXTokenContract extends BaseContract { ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial) { - super('ZRXToken', ZRXTokenContract.ABI(), address, supportedProvider, txDefaults); + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + super('ZRXToken', ZRXTokenContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( ZRXTokenContract.ABI(), this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align diff --git a/packages/abi-gen/test-cli/test_typescript/test/abi_gen_dummy_test.ts b/packages/abi-gen/test-cli/test_typescript/test/abi_gen_dummy_test.ts index 6f145a6a4f..b33bb5a57a 100644 --- a/packages/abi-gen/test-cli/test_typescript/test/abi_gen_dummy_test.ts +++ b/packages/abi-gen/test-cli/test_typescript/test/abi_gen_dummy_test.ts @@ -30,7 +30,12 @@ describe('AbiGenDummy Contract', () => { let abiGenDummy: AbiGenDummyContract; before(async () => { providerUtils.startProviderEngine(provider); - abiGenDummy = await AbiGenDummyContract.deployFrom0xArtifactAsync(artifacts.AbiGenDummy, provider, txDefaults); + abiGenDummy = await AbiGenDummyContract.deployFrom0xArtifactAsync( + artifacts.AbiGenDummy, + provider, + txDefaults, + artifacts, + ); await blockchainLifecycle.startAsync(); }); after(async () => { @@ -146,7 +151,12 @@ describe('Lib dummy contract', () => { await blockchainLifecycle.revertAsync(); }); before(async () => { - libDummy = await TestLibDummyContract.deployFrom0xArtifactAsync(artifacts.TestLibDummy, provider, txDefaults); + libDummy = await TestLibDummyContract.deployFrom0xArtifactAsync( + artifacts.TestLibDummy, + provider, + txDefaults, + artifacts, + ); }); beforeEach(async () => { await blockchainLifecycle.startAsync(); diff --git a/packages/base-contract/src/index.ts b/packages/base-contract/src/index.ts index 1e79cae696..09287a00c1 100644 --- a/packages/base-contract/src/index.ts +++ b/packages/base-contract/src/index.ts @@ -212,8 +212,8 @@ export class BaseContract { this._abiEncoderByFunctionSignature[functionSignature] = abiEncoder; this._web3Wrapper.abiDecoder.addABI(abi, contractName); }); - _.each(abiDependencies, (abi, name) => { - this._web3Wrapper.abiDecoder.addABI(abi, name); + _.each(abiDependencies, (abiDependency, contractDependencyName) => { + this._web3Wrapper.abiDecoder.addABI(abiDependency, contractDependencyName); }); } } diff --git a/packages/contract-wrappers/test/exchange_wrapper_test.ts b/packages/contract-wrappers/test/exchange_wrapper_test.ts index 29d3bbfa3c..bcb226e2ff 100644 --- a/packages/contract-wrappers/test/exchange_wrapper_test.ts +++ b/packages/contract-wrappers/test/exchange_wrapper_test.ts @@ -351,10 +351,12 @@ describe('ExchangeWrapper', () => { }); }); it('should throw when the ERC20 token has transfer restrictions', async () => { + const artifactDependencies = {}; const untransferrableToken = await DummyERC20TokenContract.deployFrom0xArtifactAsync( UntransferrableDummyERC20Token, provider, { from: userAddresses[0] }, + artifactDependencies, 'UntransferrableToken', 'UTT', new BigNumber(constants.ZRX_DECIMALS), diff --git a/packages/migrations/src/migration.ts b/packages/migrations/src/migration.ts index ecb9fb5b17..f637fb6e7e 100644 --- a/packages/migrations/src/migration.ts +++ b/packages/migrations/src/migration.ts @@ -29,11 +29,13 @@ export async function runMigrationsAsync( artifacts.ERC20Proxy, provider, txDefaults, + artifacts, ); const erc721Proxy = await wrappers.ERC721ProxyContract.deployFrom0xArtifactAsync( artifacts.ERC721Proxy, provider, txDefaults, + artifacts, ); // ZRX @@ -41,10 +43,16 @@ export async function runMigrationsAsync( artifacts.ZRXToken, provider, txDefaults, + artifacts, ); // Ether token - const etherToken = await wrappers.WETH9Contract.deployFrom0xArtifactAsync(artifacts.WETH9, provider, txDefaults); + const etherToken = await wrappers.WETH9Contract.deployFrom0xArtifactAsync( + artifacts.WETH9, + provider, + txDefaults, + artifacts, + ); // Exchange const zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address); @@ -52,6 +60,7 @@ export async function runMigrationsAsync( artifacts.Exchange, provider, txDefaults, + artifacts, zrxAssetData, ); @@ -63,6 +72,7 @@ export async function runMigrationsAsync( artifacts.DummyERC20Token, provider, txDefaults, + artifacts, token.name, token.symbol, token.decimals, @@ -76,6 +86,7 @@ export async function runMigrationsAsync( artifacts.DummyERC721Token, provider, txDefaults, + artifacts, erc721TokenInfo[0].name, erc721TokenInfo[0].symbol, ); @@ -84,6 +95,7 @@ export async function runMigrationsAsync( artifacts.MultiAssetProxy, provider, txDefaults, + artifacts, ); await web3Wrapper.awaitTransactionSuccessAsync( @@ -126,6 +138,7 @@ export async function runMigrationsAsync( artifacts.Forwarder, provider, txDefaults, + artifacts, exchange.address, assetDataUtils.encodeERC20AssetData(zrxToken.address), assetDataUtils.encodeERC20AssetData(etherToken.address), @@ -136,6 +149,7 @@ export async function runMigrationsAsync( artifacts.OrderValidator, provider, txDefaults, + artifacts, exchange.address, zrxAssetData, ); @@ -145,6 +159,7 @@ export async function runMigrationsAsync( artifacts.DutchAuction, provider, txDefaults, + artifacts, exchange.address, ); @@ -159,6 +174,7 @@ export async function runMigrationsAsync( artifacts.AssetProxyOwner, provider, txDefaults, + artifacts, owners, [erc20Proxy.address, erc721Proxy.address, multiAssetProxy.address], confirmationsRequired, @@ -188,6 +204,7 @@ export async function runMigrationsAsync( artifacts.CoordinatorRegistry, provider, txDefaults, + artifacts, ); // Coordinator @@ -195,6 +212,7 @@ export async function runMigrationsAsync( artifacts.Coordinator, provider, txDefaults, + artifacts, exchange.address, ); diff --git a/packages/order-utils/test/exchange_transfer_simulator_test.ts b/packages/order-utils/test/exchange_transfer_simulator_test.ts index c26eb19078..2f3e18dec2 100644 --- a/packages/order-utils/test/exchange_transfer_simulator_test.ts +++ b/packages/order-utils/test/exchange_transfer_simulator_test.ts @@ -46,6 +46,7 @@ describe('ExchangeTransferSimulator', async () => { artifacts.ERC20Proxy, provider, txDefaults, + artifacts, ); erc20ProxyAddress = erc20Proxy.address; @@ -58,6 +59,7 @@ describe('ExchangeTransferSimulator', async () => { artifacts.DummyERC20Token, provider, txDefaults, + artifacts, name, symbol, decimals, From 88a7d9cca8fdfe58a5ee48060c8a45e7b85540d3 Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Fri, 26 Jul 2019 18:25:30 +0200 Subject: [PATCH 03/15] Updated changelogs for deployFrom0xArtifactAsync interface change --- contracts/asset-proxy/CHANGELOG.json | 9 +++++++++ contracts/coordinator/CHANGELOG.json | 10 ++++++++++ contracts/dev-utils/CHANGELOG.json | 9 +++++++++ contracts/erc1155/CHANGELOG.json | 10 ++++++++++ contracts/erc20/CHANGELOG.json | 9 +++++++++ contracts/erc721/CHANGELOG.json | 9 +++++++++ contracts/exchange-forwarder/CHANGELOG.json | 9 +++++++++ contracts/exchange-libs/CHANGELOG.json | 9 +++++++++ contracts/exchange/CHANGELOG.json | 9 +++++++++ contracts/extensions/CHANGELOG.json | 9 +++++++++ contracts/multisig/CHANGELOG.json | 9 +++++++++ contracts/utils/CHANGELOG.json | 9 +++++++++ packages/abi-gen-templates/CHANGELOG.json | 9 +++++++++ packages/base-contract/CHANGELOG.json | 9 +++++++++ packages/contract-wrappers/CHANGELOG.json | 9 +++++++++ packages/migrations/CHANGELOG.json | 9 +++++++++ packages/order-utils/CHANGELOG.json | 9 +++++++++ 17 files changed, 155 insertions(+) diff --git a/contracts/asset-proxy/CHANGELOG.json b/contracts/asset-proxy/CHANGELOG.json index 2bb182dc61..48715ec4ac 100644 --- a/contracts/asset-proxy/CHANGELOG.json +++ b/contracts/asset-proxy/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "2.2.4", + "changes": [ + { + "note": "Updated calls to .deploy0xArtifactAsync to include artifact dependencies.", + "pr": 1995 + } + ] + }, { "timestamp": 1563957393, "version": "2.2.3", diff --git a/contracts/coordinator/CHANGELOG.json b/contracts/coordinator/CHANGELOG.json index 35cf589758..28f31eee5c 100644 --- a/contracts/coordinator/CHANGELOG.json +++ b/contracts/coordinator/CHANGELOG.json @@ -1,4 +1,14 @@ + [ + { + "version": "2.0.9", + "changes": [ + { + "note": "Updated calls to .deploy0xArtifactAsync to include artifact dependencies.", + "pr": 1995 + } + ] + }, { "timestamp": 1563957393, "version": "2.0.8", diff --git a/contracts/dev-utils/CHANGELOG.json b/contracts/dev-utils/CHANGELOG.json index 571e851bd5..36dd39311f 100644 --- a/contracts/dev-utils/CHANGELOG.json +++ b/contracts/dev-utils/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "0.0.6", + "changes": [ + { + "note": "Updated calls to .deploy0xArtifactAsync to include artifact dependencies.", + "pr": 1995 + } + ] + }, { "timestamp": 1563957393, "version": "0.0.5", diff --git a/contracts/erc1155/CHANGELOG.json b/contracts/erc1155/CHANGELOG.json index fcea4be201..968eb49b0f 100644 --- a/contracts/erc1155/CHANGELOG.json +++ b/contracts/erc1155/CHANGELOG.json @@ -1,4 +1,14 @@ + [ + { + "version": "1.1.11", + "changes": [ + { + "note": "Updated calls to .deploy0xArtifactAsync to include artifact dependencies.", + "pr": 1995 + } + ] + }, { "timestamp": 1563957393, "version": "1.1.10", diff --git a/contracts/erc20/CHANGELOG.json b/contracts/erc20/CHANGELOG.json index 747f40cc48..7740c3154b 100644 --- a/contracts/erc20/CHANGELOG.json +++ b/contracts/erc20/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "2.2.10", + "changes": [ + { + "note": "Updated calls to .deploy0xArtifactAsync to include artifact dependencies.", + "pr": 1995 + } + ] + }, { "timestamp": 1563957393, "version": "2.2.9", diff --git a/contracts/erc721/CHANGELOG.json b/contracts/erc721/CHANGELOG.json index fd81866b54..ead118f9e6 100644 --- a/contracts/erc721/CHANGELOG.json +++ b/contracts/erc721/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "2.1.11", + "changes": [ + { + "note": "Updated calls to .deploy0xArtifactAsync to include artifact dependencies.", + "pr": 1995 + } + ] + }, { "timestamp": 1563957393, "version": "2.1.10", diff --git a/contracts/exchange-forwarder/CHANGELOG.json b/contracts/exchange-forwarder/CHANGELOG.json index 18d8efdbe0..d5da6350cb 100644 --- a/contracts/exchange-forwarder/CHANGELOG.json +++ b/contracts/exchange-forwarder/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "3.0.8", + "changes": [ + { + "note": "Updated calls to .deploy0xArtifactAsync to include artifact dependencies.", + "pr": 1995 + } + ] + }, { "timestamp": 1563957393, "version": "3.0.7", diff --git a/contracts/exchange-libs/CHANGELOG.json b/contracts/exchange-libs/CHANGELOG.json index 12596d4cfc..cf15a7a57c 100644 --- a/contracts/exchange-libs/CHANGELOG.json +++ b/contracts/exchange-libs/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "3.0.4", + "changes": [ + { + "note": "Updated calls to .deploy0xArtifactAsync to include artifact dependencies.", + "pr": 1995 + } + ] + }, { "timestamp": 1563957393, "version": "3.0.3", diff --git a/contracts/exchange/CHANGELOG.json b/contracts/exchange/CHANGELOG.json index 24ef8ca438..8a2cf00b79 100644 --- a/contracts/exchange/CHANGELOG.json +++ b/contracts/exchange/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "2.1.10", + "changes": [ + { + "note": "Updated calls to .deploy0xArtifactAsync to include artifact dependencies.", + "pr": 1995 + } + ] + }, { "timestamp": 1563957393, "version": "2.1.9", diff --git a/contracts/extensions/CHANGELOG.json b/contracts/extensions/CHANGELOG.json index 5f75e76dd4..23e2f74a9d 100644 --- a/contracts/extensions/CHANGELOG.json +++ b/contracts/extensions/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "4.0.4", + "changes": [ + { + "note": "Updated calls to .deploy0xArtifactAsync to include artifact dependencies.", + "pr": 1995 + } + ] + }, { "timestamp": 1563957393, "version": "4.0.3", diff --git a/contracts/multisig/CHANGELOG.json b/contracts/multisig/CHANGELOG.json index 813c863169..3754eea6ac 100644 --- a/contracts/multisig/CHANGELOG.json +++ b/contracts/multisig/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "3.1.10", + "changes": [ + { + "note": "Updated calls to .deploy0xArtifactAsync to include artifact dependencies.", + "pr": 1995 + } + ] + }, { "timestamp": 1563957393, "version": "3.1.9", diff --git a/contracts/utils/CHANGELOG.json b/contracts/utils/CHANGELOG.json index a91f202bc3..a1d6cd67db 100644 --- a/contracts/utils/CHANGELOG.json +++ b/contracts/utils/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "3.1.11", + "changes": [ + { + "note": "Updated calls to .deploy0xArtifactAsync to include artifact dependencies.", + "pr": 1995 + } + ] + }, { "timestamp": 1563957393, "version": "3.1.10", diff --git a/packages/abi-gen-templates/CHANGELOG.json b/packages/abi-gen-templates/CHANGELOG.json index 42f193d1ea..74c93864a2 100644 --- a/packages/abi-gen-templates/CHANGELOG.json +++ b/packages/abi-gen-templates/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "2.4.0", + "changes": [ + { + "note": "Updated calls to .deploy0xArtifactAsync to include log decode dependencies.", + "pr": 1995 + } + ] + }, { "version": "2.3.0", "changes": [ diff --git a/packages/base-contract/CHANGELOG.json b/packages/base-contract/CHANGELOG.json index 905177bbe8..4e373d25aa 100644 --- a/packages/base-contract/CHANGELOG.json +++ b/packages/base-contract/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "5.3.0", + "changes": [ + { + "note": "Updated interface to .deploy0xArtifactAsync to include log decode dependencies.", + "pr": 1995 + } + ] + }, { "version": "5.2.0", "changes": [ diff --git a/packages/contract-wrappers/CHANGELOG.json b/packages/contract-wrappers/CHANGELOG.json index 413273378d..c058c8810f 100644 --- a/packages/contract-wrappers/CHANGELOG.json +++ b/packages/contract-wrappers/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "10.1.0", + "changes": [ + { + "note": "Updated calls to .deploy0xArtifactAsync to include log decode dependencies.", + "pr": 1995 + } + ] + }, { "version": "10.0.0", "changes": [ diff --git a/packages/migrations/CHANGELOG.json b/packages/migrations/CHANGELOG.json index c340d1d50a..138259ab33 100644 --- a/packages/migrations/CHANGELOG.json +++ b/packages/migrations/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "4.1.11", + "changes": [ + { + "note": "Updated calls to .deploy0xArtifactAsync to include log decode dependencies.", + "pr": 1995 + } + ] + }, { "timestamp": 1563957393, "version": "4.1.10", diff --git a/packages/order-utils/CHANGELOG.json b/packages/order-utils/CHANGELOG.json index 2e89288fd2..0497f2ed38 100644 --- a/packages/order-utils/CHANGELOG.json +++ b/packages/order-utils/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "8.2.4", + "changes": [ + { + "note": "Updated calls to .deploy0xArtifactAsync to include log decode dependencies.", + "pr": 1995 + } + ] + }, { "version": "8.2.3", "changes": [ From 365c056b0ff16cb5ed3b61b3d245e1f3dfb11cec Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Fri, 26 Jul 2019 19:10:32 +0200 Subject: [PATCH 04/15] Added tests for for decoding log arguments when artifact dependencies are included/excluded --- contracts/utils/CHANGELOG.json | 4 ++ contracts/utils/compiler.json | 4 +- .../utils/contracts/test/TestLogDecoding.sol | 46 ++++++++++++ .../test/TestLogDecodingDownstream.sol | 46 ++++++++++++ contracts/utils/package.json | 2 +- contracts/utils/src/artifacts.ts | 6 +- contracts/utils/src/wrappers.ts | 2 + contracts/utils/test/log_decoding.ts | 70 +++++++++++++++++++ contracts/utils/tsconfig.json | 4 +- 9 files changed, 180 insertions(+), 4 deletions(-) create mode 100644 contracts/utils/contracts/test/TestLogDecoding.sol create mode 100644 contracts/utils/contracts/test/TestLogDecodingDownstream.sol create mode 100644 contracts/utils/test/log_decoding.ts diff --git a/contracts/utils/CHANGELOG.json b/contracts/utils/CHANGELOG.json index a1d6cd67db..cbe11a0e09 100644 --- a/contracts/utils/CHANGELOG.json +++ b/contracts/utils/CHANGELOG.json @@ -5,6 +5,10 @@ { "note": "Updated calls to .deploy0xArtifactAsync to include artifact dependencies.", "pr": 1995 + }, + { + "note": "Added tests for decoding log arguments when artifact dependencies are included/excluded.", + "pr": 1995 } ] }, diff --git a/contracts/utils/compiler.json b/contracts/utils/compiler.json index d132a71268..01ab211056 100644 --- a/contracts/utils/compiler.json +++ b/contracts/utils/compiler.json @@ -32,6 +32,8 @@ "src/interfaces/IOwnable.sol", "test/TestConstants.sol", "test/TestLibAddressArray.sol", - "test/TestLibBytes.sol" + "test/TestLibBytes.sol", + "test/TestLogDecoding.sol", + "test/TestLogDecodingDownstream.sol" ] } diff --git a/contracts/utils/contracts/test/TestLogDecoding.sol b/contracts/utils/contracts/test/TestLogDecoding.sol new file mode 100644 index 0000000000..b79b66200b --- /dev/null +++ b/contracts/utils/contracts/test/TestLogDecoding.sol @@ -0,0 +1,46 @@ +/* + + Copyright 2018 ZeroEx Intl. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +pragma solidity ^0.5.5; + +import "./TestLogDecodingDownstream.sol"; + +contract TestLogDecoding { + + /// @dev arbitrary event; fields to not matter. + event TestEvent( + uint256 foo, + bytes bar, + string car + ); + + /// @dev Emits a local event + function emitEvent() + public + { + emit TestEvent(256, hex'1234', "4321"); + } + + /// @dev Emits an event in a downstream contract + function emitEventDownstream() + public + { + TestLogDecodingDownstream testLogDecodingDownstream = new TestLogDecodingDownstream(); + ITestLogDecodingDownstream(testLogDecodingDownstream).emitEvent(); + } +} \ No newline at end of file diff --git a/contracts/utils/contracts/test/TestLogDecodingDownstream.sol b/contracts/utils/contracts/test/TestLogDecodingDownstream.sol new file mode 100644 index 0000000000..e977f93c82 --- /dev/null +++ b/contracts/utils/contracts/test/TestLogDecodingDownstream.sol @@ -0,0 +1,46 @@ +/* + + Copyright 2018 ZeroEx Intl. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +pragma solidity ^0.5.5; + +contract ITestLogDecodingDownstream { + + /// @dev Emits a local event + function emitEvent() external; +} + +contract TestLogDecodingDownstream is + ITestLogDecodingDownstream +{ + + /// @dev event with fields different than those in `TestLogDecoding.TestEvent` + /// Note: do not include this in the interface + /// For testing, we want to emit an event that is + /// not known by the calling contract. + event TestEvent2( + uint256 lorem, + string ipsum + ); + + /// @dev Emits a local event + function emitEvent() + external + { + emit TestEvent2(256, "4321"); + } +} \ No newline at end of file diff --git a/contracts/utils/package.json b/contracts/utils/package.json index 331a0c14e9..0b11673348 100644 --- a/contracts/utils/package.json +++ b/contracts/utils/package.json @@ -34,7 +34,7 @@ "lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol" }, "config": { - "abis": "./generated-artifacts/@(Address|IOwnable|LibBytes|Ownable|ReentrancyGuard|SafeMath|TestConstants|TestLibAddressArray|TestLibBytes).json", + "abis": "./generated-artifacts/@(Address|IOwnable|LibBytes|Ownable|ReentrancyGuard|SafeMath|TestConstants|TestLibAddressArray|TestLibBytes|TestLogDecoding|TestLogDecodingDownstream).json", "abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually." }, "repository": { diff --git a/contracts/utils/src/artifacts.ts b/contracts/utils/src/artifacts.ts index 04ebb5b525..e2b2104257 100644 --- a/contracts/utils/src/artifacts.ts +++ b/contracts/utils/src/artifacts.ts @@ -14,6 +14,8 @@ import * as SafeMath from '../generated-artifacts/SafeMath.json'; import * as TestConstants from '../generated-artifacts/TestConstants.json'; import * as TestLibAddressArray from '../generated-artifacts/TestLibAddressArray.json'; import * as TestLibBytes from '../generated-artifacts/TestLibBytes.json'; +import * as TestLogDecoding from '../generated-artifacts/TestLogDecoding.json'; +import * as TestLogDecodingDownstream from '../generated-artifacts/TestLogDecodingDownstream.json'; export const artifacts = { Address: Address as ContractArtifact, LibBytes: LibBytes as ContractArtifact, @@ -22,6 +24,8 @@ export const artifacts = { SafeMath: SafeMath as ContractArtifact, IOwnable: IOwnable as ContractArtifact, TestConstants: TestConstants as ContractArtifact, - TestLibBytes: TestLibBytes as ContractArtifact, TestLibAddressArray: TestLibAddressArray as ContractArtifact, + TestLibBytes: TestLibBytes as ContractArtifact, + TestLogDecoding: TestLogDecoding as ContractArtifact, + TestLogDecodingDownstream: TestLogDecodingDownstream as ContractArtifact, }; diff --git a/contracts/utils/src/wrappers.ts b/contracts/utils/src/wrappers.ts index 91a90bec6c..be616b060f 100644 --- a/contracts/utils/src/wrappers.ts +++ b/contracts/utils/src/wrappers.ts @@ -12,3 +12,5 @@ export * from '../generated-wrappers/safe_math'; export * from '../generated-wrappers/test_constants'; export * from '../generated-wrappers/test_lib_address_array'; export * from '../generated-wrappers/test_lib_bytes'; +export * from '../generated-wrappers/test_log_decoding'; +export * from '../generated-wrappers/test_log_decoding_downstream'; diff --git a/contracts/utils/test/log_decoding.ts b/contracts/utils/test/log_decoding.ts new file mode 100644 index 0000000000..f74a72a928 --- /dev/null +++ b/contracts/utils/test/log_decoding.ts @@ -0,0 +1,70 @@ +import { chaiSetup, provider, txDefaults, web3Wrapper } from '@0x/contracts-test-utils'; +import { BlockchainLifecycle } from '@0x/dev-utils'; +import { BigNumber } from '@0x/utils'; +import * as chai from 'chai'; +import { DecodedLogArgs, LogWithDecodedArgs } from 'ethereum-types'; + +import { artifacts, TestLogDecodingContract } from '../src'; + +chaiSetup.configure(); +const expect = chai.expect; + +const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); + +describe.only('TestLogDecoding', () => { + let testLogDecodingWithDependencies: TestLogDecodingContract; + let testLogDecodingDeployedWithoutDependencies: TestLogDecodingContract; + const expectedEvent = { + foo: new BigNumber(256), + bar: "0x1234", + car: "4321", + }; + const expectedDownstreamEvent = { + lorem: new BigNumber(256), + ipsum: "4321", + } + const emptyDependencyList = {}; + + before(async () => { + testLogDecodingDeployedWithoutDependencies = await TestLogDecodingContract.deployFrom0xArtifactAsync( + artifacts.TestLogDecoding, + provider, + txDefaults, + emptyDependencyList + ); + testLogDecodingWithDependencies = await TestLogDecodingContract.deployFrom0xArtifactAsync( + artifacts.TestLogDecoding, + provider, + txDefaults, + artifacts + ); + }); + beforeEach(async () => { + await blockchainLifecycle.startAsync(); + }); + afterEach(async () => { + await blockchainLifecycle.revertAsync(); + }); + + describe('Decoding Log Arguments', () => { + it('should decode locally emitted event args when no dependencies are passed into wrapper', async () => { + const txReceipt = await testLogDecodingDeployedWithoutDependencies.emitEvent.awaitTransactionSuccessAsync(); + expect(txReceipt.logs.length).to.be.equal(1); + expect((txReceipt.logs[0] as LogWithDecodedArgs).args).to.be.deep.equal(expectedEvent); + }); + it('should not event args when no dependencies are passed into wrapper', async () => { + const txReceipt = await testLogDecodingDeployedWithoutDependencies.emitEventDownstream.awaitTransactionSuccessAsync(); + expect((txReceipt.logs[0] as LogWithDecodedArgs).args).to.be.undefined();//(emptyArgs); + }); + it('should decode locally emitted event args when dependencies are passed into wrapper', async () => { + const txReceipt = await testLogDecodingWithDependencies.emitEvent.awaitTransactionSuccessAsync(); + expect(txReceipt.logs.length).to.be.equal(1); + expect((txReceipt.logs[0] as LogWithDecodedArgs).args).to.be.deep.equal(expectedEvent); + }); + it('should decode downstream event args when dependencies are passed into wrapper', async () => { + const txReceipt = await testLogDecodingWithDependencies.emitEventDownstream.awaitTransactionSuccessAsync(); + expect(txReceipt.logs.length).to.be.equal(1); + expect((txReceipt.logs[0] as LogWithDecodedArgs).args).to.be.deep.equal(expectedDownstreamEvent); + }); + }); +}); diff --git a/contracts/utils/tsconfig.json b/contracts/utils/tsconfig.json index dce54b101e..bb3f9566be 100644 --- a/contracts/utils/tsconfig.json +++ b/contracts/utils/tsconfig.json @@ -11,7 +11,9 @@ "generated-artifacts/SafeMath.json", "generated-artifacts/TestConstants.json", "generated-artifacts/TestLibAddressArray.json", - "generated-artifacts/TestLibBytes.json" + "generated-artifacts/TestLibBytes.json", + "generated-artifacts/TestLogDecoding.json", + "generated-artifacts/TestLogDecodingDownstream.json" ], "exclude": ["./deploy/solc/solc_bin"] } From 24783107babd3c021de2cce7a5c92c58c4413151 Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Fri, 26 Jul 2019 19:23:52 +0200 Subject: [PATCH 05/15] Updated generated contract wrappers and ran linter --- contracts/coordinator/CHANGELOG.json | 1 - contracts/erc1155/CHANGELOG.json | 1 - .../utils/contracts/test/TestLogDecoding.sol | 1 + .../test/TestLogDecodingDownstream.sol | 2 ++ contracts/utils/test/log_decoding.ts | 22 ++++++++++++------- 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/contracts/coordinator/CHANGELOG.json b/contracts/coordinator/CHANGELOG.json index 28f31eee5c..5e4de0da30 100644 --- a/contracts/coordinator/CHANGELOG.json +++ b/contracts/coordinator/CHANGELOG.json @@ -1,4 +1,3 @@ - [ { "version": "2.0.9", diff --git a/contracts/erc1155/CHANGELOG.json b/contracts/erc1155/CHANGELOG.json index 968eb49b0f..38c845e207 100644 --- a/contracts/erc1155/CHANGELOG.json +++ b/contracts/erc1155/CHANGELOG.json @@ -1,4 +1,3 @@ - [ { "version": "1.1.11", diff --git a/contracts/utils/contracts/test/TestLogDecoding.sol b/contracts/utils/contracts/test/TestLogDecoding.sol index b79b66200b..145cebf143 100644 --- a/contracts/utils/contracts/test/TestLogDecoding.sol +++ b/contracts/utils/contracts/test/TestLogDecoding.sol @@ -20,6 +20,7 @@ pragma solidity ^0.5.5; import "./TestLogDecodingDownstream.sol"; + contract TestLogDecoding { /// @dev arbitrary event; fields to not matter. diff --git a/contracts/utils/contracts/test/TestLogDecodingDownstream.sol b/contracts/utils/contracts/test/TestLogDecodingDownstream.sol index e977f93c82..adb2ffe453 100644 --- a/contracts/utils/contracts/test/TestLogDecodingDownstream.sol +++ b/contracts/utils/contracts/test/TestLogDecodingDownstream.sol @@ -18,12 +18,14 @@ pragma solidity ^0.5.5; + contract ITestLogDecodingDownstream { /// @dev Emits a local event function emitEvent() external; } + contract TestLogDecodingDownstream is ITestLogDecodingDownstream { diff --git a/contracts/utils/test/log_decoding.ts b/contracts/utils/test/log_decoding.ts index f74a72a928..3422dc06b1 100644 --- a/contracts/utils/test/log_decoding.ts +++ b/contracts/utils/test/log_decoding.ts @@ -16,13 +16,13 @@ describe.only('TestLogDecoding', () => { let testLogDecodingDeployedWithoutDependencies: TestLogDecodingContract; const expectedEvent = { foo: new BigNumber(256), - bar: "0x1234", - car: "4321", + bar: '0x1234', + car: '4321', }; const expectedDownstreamEvent = { lorem: new BigNumber(256), - ipsum: "4321", - } + ipsum: '4321', + }; const emptyDependencyList = {}; before(async () => { @@ -30,13 +30,13 @@ describe.only('TestLogDecoding', () => { artifacts.TestLogDecoding, provider, txDefaults, - emptyDependencyList + emptyDependencyList, ); testLogDecodingWithDependencies = await TestLogDecodingContract.deployFrom0xArtifactAsync( artifacts.TestLogDecoding, provider, txDefaults, - artifacts + artifacts, ); }); beforeEach(async () => { @@ -50,21 +50,27 @@ describe.only('TestLogDecoding', () => { it('should decode locally emitted event args when no dependencies are passed into wrapper', async () => { const txReceipt = await testLogDecodingDeployedWithoutDependencies.emitEvent.awaitTransactionSuccessAsync(); expect(txReceipt.logs.length).to.be.equal(1); + // tslint:disable no-unnecessary-type-assertion expect((txReceipt.logs[0] as LogWithDecodedArgs).args).to.be.deep.equal(expectedEvent); }); it('should not event args when no dependencies are passed into wrapper', async () => { const txReceipt = await testLogDecodingDeployedWithoutDependencies.emitEventDownstream.awaitTransactionSuccessAsync(); - expect((txReceipt.logs[0] as LogWithDecodedArgs).args).to.be.undefined();//(emptyArgs); + // tslint:disable no-unnecessary-type-assertion + expect((txReceipt.logs[0] as LogWithDecodedArgs).args).to.be.undefined(); }); it('should decode locally emitted event args when dependencies are passed into wrapper', async () => { const txReceipt = await testLogDecodingWithDependencies.emitEvent.awaitTransactionSuccessAsync(); expect(txReceipt.logs.length).to.be.equal(1); + // tslint:disable no-unnecessary-type-assertion expect((txReceipt.logs[0] as LogWithDecodedArgs).args).to.be.deep.equal(expectedEvent); }); it('should decode downstream event args when dependencies are passed into wrapper', async () => { const txReceipt = await testLogDecodingWithDependencies.emitEventDownstream.awaitTransactionSuccessAsync(); expect(txReceipt.logs.length).to.be.equal(1); - expect((txReceipt.logs[0] as LogWithDecodedArgs).args).to.be.deep.equal(expectedDownstreamEvent); + // tslint:disable no-unnecessary-type-assertion + expect((txReceipt.logs[0] as LogWithDecodedArgs).args).to.be.deep.equal( + expectedDownstreamEvent, + ); }); }); }); From 2968dfb2aea0fa800ca4f0760e2498f3be27a457 Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Fri, 26 Jul 2019 19:36:04 +0200 Subject: [PATCH 06/15] Minor readability improvements --- contracts/asset-proxy/CHANGELOG.json | 2 +- contracts/coordinator/CHANGELOG.json | 2 +- contracts/dev-utils/CHANGELOG.json | 2 +- contracts/erc1155/CHANGELOG.json | 2 +- contracts/erc20/CHANGELOG.json | 2 +- contracts/erc721/CHANGELOG.json | 2 +- contracts/exchange-forwarder/CHANGELOG.json | 2 +- contracts/exchange-libs/CHANGELOG.json | 2 +- contracts/exchange/CHANGELOG.json | 2 +- contracts/extensions/CHANGELOG.json | 2 +- contracts/multisig/CHANGELOG.json | 2 +- contracts/utils/CHANGELOG.json | 4 ++-- contracts/utils/test/log_decoding.ts | 2 +- packages/abi-gen-templates/CHANGELOG.json | 6 +++++- packages/base-contract/CHANGELOG.json | 6 +++++- packages/contract-wrappers/CHANGELOG.json | 6 +++++- 16 files changed, 29 insertions(+), 17 deletions(-) diff --git a/contracts/asset-proxy/CHANGELOG.json b/contracts/asset-proxy/CHANGELOG.json index 48715ec4ac..bacae283f3 100644 --- a/contracts/asset-proxy/CHANGELOG.json +++ b/contracts/asset-proxy/CHANGELOG.json @@ -3,7 +3,7 @@ "version": "2.2.4", "changes": [ { - "note": "Updated calls to .deploy0xArtifactAsync to include artifact dependencies.", + "note": "Updated calls to .deployFrom0xArtifactAsync to include artifact dependencies.", "pr": 1995 } ] diff --git a/contracts/coordinator/CHANGELOG.json b/contracts/coordinator/CHANGELOG.json index 5e4de0da30..e0b850a28b 100644 --- a/contracts/coordinator/CHANGELOG.json +++ b/contracts/coordinator/CHANGELOG.json @@ -3,7 +3,7 @@ "version": "2.0.9", "changes": [ { - "note": "Updated calls to .deploy0xArtifactAsync to include artifact dependencies.", + "note": "Updated calls to .deployFrom0xArtifactAsync to include artifact dependencies.", "pr": 1995 } ] diff --git a/contracts/dev-utils/CHANGELOG.json b/contracts/dev-utils/CHANGELOG.json index 36dd39311f..5008c1e250 100644 --- a/contracts/dev-utils/CHANGELOG.json +++ b/contracts/dev-utils/CHANGELOG.json @@ -3,7 +3,7 @@ "version": "0.0.6", "changes": [ { - "note": "Updated calls to .deploy0xArtifactAsync to include artifact dependencies.", + "note": "Updated calls to .deployFrom0xArtifactAsync to include artifact dependencies.", "pr": 1995 } ] diff --git a/contracts/erc1155/CHANGELOG.json b/contracts/erc1155/CHANGELOG.json index 38c845e207..2467578051 100644 --- a/contracts/erc1155/CHANGELOG.json +++ b/contracts/erc1155/CHANGELOG.json @@ -3,7 +3,7 @@ "version": "1.1.11", "changes": [ { - "note": "Updated calls to .deploy0xArtifactAsync to include artifact dependencies.", + "note": "Updated calls to .deployFrom0xArtifactAsync to include artifact dependencies.", "pr": 1995 } ] diff --git a/contracts/erc20/CHANGELOG.json b/contracts/erc20/CHANGELOG.json index 7740c3154b..c6eb414b52 100644 --- a/contracts/erc20/CHANGELOG.json +++ b/contracts/erc20/CHANGELOG.json @@ -3,7 +3,7 @@ "version": "2.2.10", "changes": [ { - "note": "Updated calls to .deploy0xArtifactAsync to include artifact dependencies.", + "note": "Updated calls to .deployFrom0xArtifactAsync to include artifact dependencies.", "pr": 1995 } ] diff --git a/contracts/erc721/CHANGELOG.json b/contracts/erc721/CHANGELOG.json index ead118f9e6..c4b04e2b33 100644 --- a/contracts/erc721/CHANGELOG.json +++ b/contracts/erc721/CHANGELOG.json @@ -3,7 +3,7 @@ "version": "2.1.11", "changes": [ { - "note": "Updated calls to .deploy0xArtifactAsync to include artifact dependencies.", + "note": "Updated calls to .deployFrom0xArtifactAsync to include artifact dependencies.", "pr": 1995 } ] diff --git a/contracts/exchange-forwarder/CHANGELOG.json b/contracts/exchange-forwarder/CHANGELOG.json index d5da6350cb..0ab43b00e5 100644 --- a/contracts/exchange-forwarder/CHANGELOG.json +++ b/contracts/exchange-forwarder/CHANGELOG.json @@ -3,7 +3,7 @@ "version": "3.0.8", "changes": [ { - "note": "Updated calls to .deploy0xArtifactAsync to include artifact dependencies.", + "note": "Updated calls to .deployFrom0xArtifactAsync to include artifact dependencies.", "pr": 1995 } ] diff --git a/contracts/exchange-libs/CHANGELOG.json b/contracts/exchange-libs/CHANGELOG.json index cf15a7a57c..6b10657a53 100644 --- a/contracts/exchange-libs/CHANGELOG.json +++ b/contracts/exchange-libs/CHANGELOG.json @@ -3,7 +3,7 @@ "version": "3.0.4", "changes": [ { - "note": "Updated calls to .deploy0xArtifactAsync to include artifact dependencies.", + "note": "Updated calls to .deployFrom0xArtifactAsync to include artifact dependencies.", "pr": 1995 } ] diff --git a/contracts/exchange/CHANGELOG.json b/contracts/exchange/CHANGELOG.json index 8a2cf00b79..aec0453f09 100644 --- a/contracts/exchange/CHANGELOG.json +++ b/contracts/exchange/CHANGELOG.json @@ -3,7 +3,7 @@ "version": "2.1.10", "changes": [ { - "note": "Updated calls to .deploy0xArtifactAsync to include artifact dependencies.", + "note": "Updated calls to .deployFrom0xArtifactAsync to include artifact dependencies.", "pr": 1995 } ] diff --git a/contracts/extensions/CHANGELOG.json b/contracts/extensions/CHANGELOG.json index 23e2f74a9d..88d1b84925 100644 --- a/contracts/extensions/CHANGELOG.json +++ b/contracts/extensions/CHANGELOG.json @@ -3,7 +3,7 @@ "version": "4.0.4", "changes": [ { - "note": "Updated calls to .deploy0xArtifactAsync to include artifact dependencies.", + "note": "Updated calls to .deployFrom0xArtifactAsync to include artifact dependencies.", "pr": 1995 } ] diff --git a/contracts/multisig/CHANGELOG.json b/contracts/multisig/CHANGELOG.json index 3754eea6ac..f0b0252ff7 100644 --- a/contracts/multisig/CHANGELOG.json +++ b/contracts/multisig/CHANGELOG.json @@ -3,7 +3,7 @@ "version": "3.1.10", "changes": [ { - "note": "Updated calls to .deploy0xArtifactAsync to include artifact dependencies.", + "note": "Updated calls to .deployFrom0xArtifactAsync to include artifact dependencies.", "pr": 1995 } ] diff --git a/contracts/utils/CHANGELOG.json b/contracts/utils/CHANGELOG.json index cbe11a0e09..f3b4c95b34 100644 --- a/contracts/utils/CHANGELOG.json +++ b/contracts/utils/CHANGELOG.json @@ -1,9 +1,9 @@ [ { - "version": "3.1.11", + "version": "3.2.0", "changes": [ { - "note": "Updated calls to .deploy0xArtifactAsync to include artifact dependencies.", + "note": "Updated calls to .deployFrom0xArtifactAsync to include artifact dependencies.", "pr": 1995 }, { diff --git a/contracts/utils/test/log_decoding.ts b/contracts/utils/test/log_decoding.ts index 3422dc06b1..141731892a 100644 --- a/contracts/utils/test/log_decoding.ts +++ b/contracts/utils/test/log_decoding.ts @@ -11,7 +11,7 @@ const expect = chai.expect; const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); -describe.only('TestLogDecoding', () => { +describe('TestLogDecoding', () => { let testLogDecodingWithDependencies: TestLogDecodingContract; let testLogDecodingDeployedWithoutDependencies: TestLogDecodingContract; const expectedEvent = { diff --git a/packages/abi-gen-templates/CHANGELOG.json b/packages/abi-gen-templates/CHANGELOG.json index 74c93864a2..05a8b3878e 100644 --- a/packages/abi-gen-templates/CHANGELOG.json +++ b/packages/abi-gen-templates/CHANGELOG.json @@ -3,7 +3,11 @@ "version": "2.4.0", "changes": [ { - "note": "Updated calls to .deploy0xArtifactAsync to include log decode dependencies.", + "note": "Updated interface to `deployFrom0xArtifactAsync` to include log decode dependencies.", + "pr": 1995 + }, + { + "note": "Updated interface to `deployAsync` to include log decode dependencies.", "pr": 1995 } ] diff --git a/packages/base-contract/CHANGELOG.json b/packages/base-contract/CHANGELOG.json index 4e373d25aa..19faddc6aa 100644 --- a/packages/base-contract/CHANGELOG.json +++ b/packages/base-contract/CHANGELOG.json @@ -3,7 +3,11 @@ "version": "5.3.0", "changes": [ { - "note": "Updated interface to .deploy0xArtifactAsync to include log decode dependencies.", + "note": "Updated interface to `deployFrom0xArtifactAsync` to include log decode dependencies.", + "pr": 1995 + }, + { + "note": "Updated interface to `deployAsync` to include log decode dependencies.", "pr": 1995 } ] diff --git a/packages/contract-wrappers/CHANGELOG.json b/packages/contract-wrappers/CHANGELOG.json index c058c8810f..6a9011b151 100644 --- a/packages/contract-wrappers/CHANGELOG.json +++ b/packages/contract-wrappers/CHANGELOG.json @@ -3,7 +3,11 @@ "version": "10.1.0", "changes": [ { - "note": "Updated calls to .deploy0xArtifactAsync to include log decode dependencies.", + "note": "Updated interface to `deployFrom0xArtifactAsync` to include log decode dependencies.", + "pr": 1995 + }, + { + "note": "Updated interface to `deployAsync` to include log decode dependencies.", "pr": 1995 } ] From ea8fc1d93f12bf17256e103bf5553fbdf590b56a Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Fri, 26 Jul 2019 19:45:19 +0200 Subject: [PATCH 07/15] updated test output from abi-gen to account for changes to `deployFrom0xArtifactAsync` and `deployAsync` --- .../generated-wrappers/asset_proxy_owner.ts | 2355 ++++---- .../src/generated-wrappers/coordinator.ts | 623 +- .../coordinator_registry.ts | 252 +- .../generated-wrappers/dummy_erc20_token.ts | 1301 ++--- .../generated-wrappers/dummy_erc721_token.ts | 1648 +++--- .../src/generated-wrappers/dutch_auction.ts | 686 ++- .../src/generated-wrappers/erc20_proxy.ts | 822 ++- .../src/generated-wrappers/erc20_token.ts | 644 +- .../src/generated-wrappers/erc721_proxy.ts | 822 ++- .../src/generated-wrappers/erc721_token.ts | 1068 ++-- .../generated-wrappers/eth_balance_checker.ts | 78 +- .../src/generated-wrappers/exchange.ts | 5195 ++++++++++------- .../src/generated-wrappers/forwarder.ts | 1307 +++-- .../src/generated-wrappers/i_asset_proxy.ts | 906 ++- .../src/generated-wrappers/i_validator.ts | 83 +- .../src/generated-wrappers/i_wallet.ts | 75 +- .../generated-wrappers/multi_asset_proxy.ts | 1043 ++-- .../src/generated-wrappers/order_validator.ts | 588 +- .../src/generated-wrappers/weth9.ts | 1029 ++-- .../src/generated-wrappers/zrx_token.ts | 733 ++- .../typescript/abi_gen_dummy.ts | 27 +- .../expected-output/typescript/lib_dummy.ts | 27 +- .../typescript/test_lib_dummy.ts | 34 +- 23 files changed, 11162 insertions(+), 10184 deletions(-) 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 98f51c02d7..75c19b4e4f 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 @@ -1,11 +1,14 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, +import { + BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; + SubscriptionManager, + PromiseWithTransactionHash, +} from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -111,7 +114,6 @@ export interface AssetProxyOwnerRequirementChangeEventArgs extends DecodedLogArg required: BigNumber; } - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name @@ -121,8 +123,7 @@ export class AssetProxyOwnerContract extends BaseContract { index_0: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -132,9 +133,8 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('owners(uint256)', [index_0 - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('owners(uint256)', [index_0]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -143,54 +143,45 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owners(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: BigNumber, - ): string { + getABIEncodedTransactionData(index_0: BigNumber): string { assert.isBigNumber('index_0', index_0); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('owners(uint256)', [index_0 - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('owners(uint256)', [index_0]); return abiEncodedTransactionData; }, }; public removeOwner = { - async sendTransactionAsync( - owner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('owner', owner); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeOwner.estimateGasAsync.bind( - self, - owner.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(owner: string, txData?: Partial | undefined): Promise { + assert.isString('owner', owner); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeOwner.estimateGasAsync.bind(self, owner.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( owner: string, @@ -198,51 +189,41 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('owner', owner); - const self = this as any as AssetProxyOwnerContract; - const txHashPromise = self.removeOwner.sendTransactionAsync(owner.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('owner', owner); + const self = (this as any) as AssetProxyOwnerContract; + const txHashPromise = self.removeOwner.sendTransactionAsync(owner.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - owner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('owner', owner); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(owner: string, txData?: Partial | undefined): Promise { + assert.isString('owner', owner); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - owner: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(owner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('owner', owner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -252,9 +233,8 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner.toLowerCase() - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -263,54 +243,47 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeOwner(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - owner: string, - ): string { + getABIEncodedTransactionData(owner: string): string { assert.isString('owner', owner); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeOwner(address)', [owner.toLowerCase() - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeOwner(address)', [ + owner.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public revokeConfirmation = { - async sendTransactionAsync( - transactionId: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.revokeConfirmation.estimateGasAsync.bind( - self, - transactionId - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(transactionId: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('transactionId', transactionId); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.revokeConfirmation.estimateGasAsync.bind(self, transactionId), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( transactionId: BigNumber, @@ -318,51 +291,45 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const txHashPromise = self.revokeConfirmation.sendTransactionAsync(transactionId - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('transactionId', transactionId); + const self = (this as any) as AssetProxyOwnerContract; + const txHashPromise = self.revokeConfirmation.sendTransactionAsync(transactionId, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - transactionId: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(transactionId: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('transactionId', transactionId); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( transactionId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('transactionId', transactionId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -372,9 +339,8 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -383,24 +349,24 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('revokeConfirmation(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - transactionId: BigNumber, - ): string { + getABIEncodedTransactionData(transactionId: BigNumber): string { assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('revokeConfirmation(uint256)', [ + transactionId, + ]); return abiEncodedTransactionData; }, }; @@ -409,8 +375,7 @@ export class AssetProxyOwnerContract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -420,9 +385,8 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('isOwner(address)', [index_0.toLowerCase() - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('isOwner(address)', [index_0.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -431,24 +395,22 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isOwner(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: string, - ): string { + getABIEncodedTransactionData(index_0: string): string { assert.isString('index_0', index_0); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('isOwner(address)', [index_0.toLowerCase() - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isOwner(address)', [index_0.toLowerCase()]); return abiEncodedTransactionData; }, }; @@ -458,8 +420,7 @@ export class AssetProxyOwnerContract extends BaseContract { index_1: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('index_0', index_0); assert.isString('index_1', index_1); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -470,10 +431,11 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('confirmations(uint256,address)', [index_0, - index_1.toLowerCase() - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('confirmations(uint256,address)', [ + index_0, + index_1.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -482,57 +444,51 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('confirmations(uint256,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: BigNumber, - index_1: string, - ): string { + getABIEncodedTransactionData(index_0: BigNumber, index_1: string): string { assert.isBigNumber('index_0', index_0); assert.isString('index_1', index_1); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('confirmations(uint256,address)', [index_0, - index_1.toLowerCase() - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('confirmations(uint256,address)', [ + index_0, + index_1.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public executeRemoveAuthorizedAddressAtIndex = { - async sendTransactionAsync( - transactionId: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.executeRemoveAuthorizedAddressAtIndex.estimateGasAsync.bind( - self, - transactionId - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(transactionId: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('transactionId', transactionId); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [ + transactionId, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.executeRemoveAuthorizedAddressAtIndex.estimateGasAsync.bind(self, transactionId), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( transactionId: BigNumber, @@ -540,51 +496,50 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const txHashPromise = self.executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(transactionId - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('transactionId', transactionId); + const self = (this as any) as AssetProxyOwnerContract; + const txHashPromise = self.executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync( + transactionId, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - transactionId: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(transactionId: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('transactionId', transactionId); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [ + transactionId, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( transactionId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('transactionId', transactionId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -594,9 +549,10 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [transactionId - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [ + transactionId, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -605,33 +561,30 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('executeRemoveAuthorizedAddressAtIndex(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - transactionId: BigNumber, - ): string { + getABIEncodedTransactionData(transactionId: BigNumber): string { assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [transactionId - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'executeRemoveAuthorizedAddressAtIndex(uint256)', + [transactionId], + ); return abiEncodedTransactionData; }, }; public secondsTimeLocked = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -640,7 +593,7 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; + const self = (this as any) as AssetProxyOwnerContract; const encodedData = self._strictEncodeArguments('secondsTimeLocked()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -650,20 +603,20 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('secondsTimeLocked()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as AssetProxyOwnerContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as AssetProxyOwnerContract; const abiEncodedTransactionData = self._strictEncodeArguments('secondsTimeLocked()', []); return abiEncodedTransactionData; }, @@ -674,8 +627,7 @@ export class AssetProxyOwnerContract extends BaseContract { executed: boolean, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBoolean('pending', pending); assert.isBoolean('executed', executed); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -686,10 +638,8 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('getTransactionCount(bool,bool)', [pending, - executed - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('getTransactionCount(bool,bool)', [pending, executed]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -698,27 +648,26 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getTransactionCount(bool,bool)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - pending: boolean, - executed: boolean, - ): string { + getABIEncodedTransactionData(pending: boolean, executed: boolean): string { assert.isBoolean('pending', pending); assert.isBoolean('executed', executed); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getTransactionCount(bool,bool)', [pending, - executed - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getTransactionCount(bool,bool)', [ + pending, + executed, + ]); return abiEncodedTransactionData; }, }; @@ -726,33 +675,30 @@ export class AssetProxyOwnerContract extends BaseContract { async sendTransactionAsync( assetProxyContract: string, isRegistered: boolean, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('assetProxyContract', assetProxyContract); - assert.isBoolean('isRegistered', isRegistered); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [assetProxyContract.toLowerCase(), - isRegistered - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.registerAssetProxy.estimateGasAsync.bind( - self, + assert.isString('assetProxyContract', assetProxyContract); + assert.isBoolean('isRegistered', isRegistered); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [ assetProxyContract.toLowerCase(), - isRegistered - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + isRegistered, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.registerAssetProxy.estimateGasAsync.bind(self, assetProxyContract.toLowerCase(), isRegistered), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( assetProxyContract: string, @@ -761,57 +707,59 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('assetProxyContract', assetProxyContract); - assert.isBoolean('isRegistered', isRegistered); - const self = this as any as AssetProxyOwnerContract; - const txHashPromise = self.registerAssetProxy.sendTransactionAsync(assetProxyContract.toLowerCase(), - isRegistered - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('assetProxyContract', assetProxyContract); + assert.isBoolean('isRegistered', isRegistered); + const self = (this as any) as AssetProxyOwnerContract; + const txHashPromise = self.registerAssetProxy.sendTransactionAsync( + assetProxyContract.toLowerCase(), + isRegistered, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( assetProxyContract: string, isRegistered: boolean, txData?: Partial | undefined, ): Promise { - assert.isString('assetProxyContract', assetProxyContract); - assert.isBoolean('isRegistered', isRegistered); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [assetProxyContract.toLowerCase(), - isRegistered - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('assetProxyContract', assetProxyContract); + assert.isBoolean('isRegistered', isRegistered); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [ + assetProxyContract.toLowerCase(), + isRegistered, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( assetProxyContract: string, isRegistered: boolean, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('assetProxyContract', assetProxyContract); assert.isBoolean('isRegistered', isRegistered); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -822,10 +770,11 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [assetProxyContract.toLowerCase(), - isRegistered - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [ + assetProxyContract.toLowerCase(), + isRegistered, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -834,57 +783,49 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address,bool)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - assetProxyContract: string, - isRegistered: boolean, - ): string { + getABIEncodedTransactionData(assetProxyContract: string, isRegistered: boolean): string { assert.isString('assetProxyContract', assetProxyContract); assert.isBoolean('isRegistered', isRegistered); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [assetProxyContract.toLowerCase(), - isRegistered - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [ + assetProxyContract.toLowerCase(), + isRegistered, + ]); return abiEncodedTransactionData; }, }; public addOwner = { - async sendTransactionAsync( - owner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('owner', owner); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.addOwner.estimateGasAsync.bind( - self, - owner.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(owner: string, txData?: Partial | undefined): Promise { + assert.isString('owner', owner); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.addOwner.estimateGasAsync.bind(self, owner.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( owner: string, @@ -892,51 +833,41 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('owner', owner); - const self = this as any as AssetProxyOwnerContract; - const txHashPromise = self.addOwner.sendTransactionAsync(owner.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('owner', owner); + const self = (this as any) as AssetProxyOwnerContract; + const txHashPromise = self.addOwner.sendTransactionAsync(owner.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - owner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('owner', owner); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(owner: string, txData?: Partial | undefined): Promise { + assert.isString('owner', owner); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - owner: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(owner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('owner', owner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -946,9 +877,8 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase() - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -957,24 +887,22 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('addOwner(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - owner: string, - ): string { + getABIEncodedTransactionData(owner: string): string { assert.isString('owner', owner); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase() - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase()]); return abiEncodedTransactionData; }, }; @@ -983,8 +911,7 @@ export class AssetProxyOwnerContract extends BaseContract { transactionId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('transactionId', transactionId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -994,9 +921,8 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('isConfirmed(uint256)', [transactionId - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('isConfirmed(uint256)', [transactionId]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1005,54 +931,48 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isConfirmed(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - transactionId: BigNumber, - ): string { + getABIEncodedTransactionData(transactionId: BigNumber): string { assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('isConfirmed(uint256)', [transactionId - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isConfirmed(uint256)', [transactionId]); return abiEncodedTransactionData; }, }; public changeTimeLock = { async sendTransactionAsync( _secondsTimeLocked: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.changeTimeLock.estimateGasAsync.bind( - self, - _secondsTimeLocked - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.changeTimeLock.estimateGasAsync.bind(self, _secondsTimeLocked), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _secondsTimeLocked: BigNumber, @@ -1060,51 +980,45 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); - const self = this as any as AssetProxyOwnerContract; - const txHashPromise = self.changeTimeLock.sendTransactionAsync(_secondsTimeLocked - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); + const self = (this as any) as AssetProxyOwnerContract; + const txHashPromise = self.changeTimeLock.sendTransactionAsync(_secondsTimeLocked, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - _secondsTimeLocked: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(_secondsTimeLocked: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _secondsTimeLocked: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1114,9 +1028,8 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1125,24 +1038,24 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('changeTimeLock(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _secondsTimeLocked: BigNumber, - ): string { + getABIEncodedTransactionData(_secondsTimeLocked: BigNumber): string { assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('changeTimeLock(uint256)', [ + _secondsTimeLocked, + ]); return abiEncodedTransactionData; }, }; @@ -1151,8 +1064,7 @@ export class AssetProxyOwnerContract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1162,9 +1074,8 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('isAssetProxyRegistered(address)', [index_0.toLowerCase() - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('isAssetProxyRegistered(address)', [index_0.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1173,24 +1084,24 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isAssetProxyRegistered(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: string, - ): string { + getABIEncodedTransactionData(index_0: string): string { assert.isString('index_0', index_0); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('isAssetProxyRegistered(address)', [index_0.toLowerCase() - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isAssetProxyRegistered(address)', [ + index_0.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; @@ -1199,8 +1110,7 @@ export class AssetProxyOwnerContract extends BaseContract { transactionId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('transactionId', transactionId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1210,9 +1120,8 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('getConfirmationCount(uint256)', [transactionId - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('getConfirmationCount(uint256)', [transactionId]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1221,24 +1130,24 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getConfirmationCount(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - transactionId: BigNumber, - ): string { + getABIEncodedTransactionData(transactionId: BigNumber): string { assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getConfirmationCount(uint256)', [transactionId - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getConfirmationCount(uint256)', [ + transactionId, + ]); return abiEncodedTransactionData; }, }; @@ -1247,8 +1156,7 @@ export class AssetProxyOwnerContract extends BaseContract { index_0: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<[string, BigNumber, string, boolean] - > { + ): Promise<[string, BigNumber, string, boolean]> { assert.isBigNumber('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1258,9 +1166,8 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('transactions(uint256)', [index_0 - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('transactions(uint256)', [index_0]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1269,33 +1176,27 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transactions(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<[string, BigNumber, string, boolean] - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<[string, BigNumber, string, boolean]>(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: BigNumber, - ): string { + getABIEncodedTransactionData(index_0: BigNumber): string { assert.isBigNumber('index_0', index_0); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transactions(uint256)', [index_0 - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transactions(uint256)', [index_0]); return abiEncodedTransactionData; }, }; public getOwners = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -1304,7 +1205,7 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; + const self = (this as any) as AssetProxyOwnerContract; const encodedData = self._strictEncodeArguments('getOwners()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1314,20 +1215,20 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getOwners()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as AssetProxyOwnerContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as AssetProxyOwnerContract; const abiEncodedTransactionData = self._strictEncodeArguments('getOwners()', []); return abiEncodedTransactionData; }, @@ -1340,8 +1241,7 @@ export class AssetProxyOwnerContract extends BaseContract { executed: boolean, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('from', from); assert.isBigNumber('to', to); assert.isBoolean('pending', pending); @@ -1354,12 +1254,13 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('getTransactionIds(uint256,uint256,bool,bool)', [from, - to, - pending, - executed - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('getTransactionIds(uint256,uint256,bool,bool)', [ + from, + to, + pending, + executed, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1368,33 +1269,28 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getTransactionIds(uint256,uint256,bool,bool)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - from: BigNumber, - to: BigNumber, - pending: boolean, - executed: boolean, - ): string { + getABIEncodedTransactionData(from: BigNumber, to: BigNumber, pending: boolean, executed: boolean): string { assert.isBigNumber('from', from); assert.isBigNumber('to', to); assert.isBoolean('pending', pending); assert.isBoolean('executed', executed); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getTransactionIds(uint256,uint256,bool,bool)', [from, - to, - pending, - executed - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'getTransactionIds(uint256,uint256,bool,bool)', + [from, to, pending, executed], + ); return abiEncodedTransactionData; }, }; @@ -1403,8 +1299,7 @@ export class AssetProxyOwnerContract extends BaseContract { transactionId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('transactionId', transactionId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1414,9 +1309,8 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('getConfirmations(uint256)', [transactionId - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('getConfirmations(uint256)', [transactionId]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1425,33 +1319,27 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getConfirmations(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - transactionId: BigNumber, - ): string { + getABIEncodedTransactionData(transactionId: BigNumber): string { assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getConfirmations(uint256)', [transactionId - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getConfirmations(uint256)', [transactionId]); return abiEncodedTransactionData; }, }; public transactionCount = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -1460,7 +1348,7 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; + const self = (this as any) as AssetProxyOwnerContract; const encodedData = self._strictEncodeArguments('transactionCount()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1470,51 +1358,44 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transactionCount()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as AssetProxyOwnerContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as AssetProxyOwnerContract; const abiEncodedTransactionData = self._strictEncodeArguments('transactionCount()', []); return abiEncodedTransactionData; }, }; public changeRequirement = { - async sendTransactionAsync( - _required: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('_required', _required); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('changeRequirement(uint256)', [_required - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.changeRequirement.estimateGasAsync.bind( - self, - _required - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(_required: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('_required', _required); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('changeRequirement(uint256)', [_required]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.changeRequirement.estimateGasAsync.bind(self, _required), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _required: BigNumber, @@ -1522,51 +1403,45 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('_required', _required); - const self = this as any as AssetProxyOwnerContract; - const txHashPromise = self.changeRequirement.sendTransactionAsync(_required - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('_required', _required); + const self = (this as any) as AssetProxyOwnerContract; + const txHashPromise = self.changeRequirement.sendTransactionAsync(_required, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - _required: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('_required', _required); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('changeRequirement(uint256)', [_required - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(_required: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('_required', _required); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('changeRequirement(uint256)', [_required]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _required: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('_required', _required); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1576,9 +1451,8 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('changeRequirement(uint256)', [_required - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('changeRequirement(uint256)', [_required]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1587,54 +1461,45 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('changeRequirement(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _required: BigNumber, - ): string { + getABIEncodedTransactionData(_required: BigNumber): string { assert.isBigNumber('_required', _required); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('changeRequirement(uint256)', [_required - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('changeRequirement(uint256)', [_required]); return abiEncodedTransactionData; }, }; public confirmTransaction = { - async sendTransactionAsync( - transactionId: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.confirmTransaction.estimateGasAsync.bind( - self, - transactionId - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(transactionId: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('transactionId', transactionId); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.confirmTransaction.estimateGasAsync.bind(self, transactionId), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( transactionId: BigNumber, @@ -1642,51 +1507,45 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const txHashPromise = self.confirmTransaction.sendTransactionAsync(transactionId - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('transactionId', transactionId); + const self = (this as any) as AssetProxyOwnerContract; + const txHashPromise = self.confirmTransaction.sendTransactionAsync(transactionId, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - transactionId: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(transactionId: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('transactionId', transactionId); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( transactionId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('transactionId', transactionId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1696,9 +1555,8 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1707,24 +1565,24 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('confirmTransaction(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - transactionId: BigNumber, - ): string { + getABIEncodedTransactionData(transactionId: BigNumber): string { assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('confirmTransaction(uint256)', [ + transactionId, + ]); return abiEncodedTransactionData; }, }; @@ -1733,36 +1591,32 @@ export class AssetProxyOwnerContract extends BaseContract { destination: string, value: BigNumber, data: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('destination', destination); - assert.isBigNumber('value', value); - assert.isString('data', data); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [destination.toLowerCase(), - value, - data - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.submitTransaction.estimateGasAsync.bind( - self, + assert.isString('destination', destination); + assert.isBigNumber('value', value); + assert.isString('data', data); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [ destination.toLowerCase(), value, - data - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + data, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.submitTransaction.estimateGasAsync.bind(self, destination.toLowerCase(), value, data), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( destination: string, @@ -1772,25 +1626,27 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('destination', destination); - assert.isBigNumber('value', value); - assert.isString('data', data); - const self = this as any as AssetProxyOwnerContract; - const txHashPromise = self.submitTransaction.sendTransactionAsync(destination.toLowerCase(), - value, - data - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('destination', destination); + assert.isBigNumber('value', value); + assert.isString('data', data); + const self = (this as any) as AssetProxyOwnerContract; + const txHashPromise = self.submitTransaction.sendTransactionAsync( + destination.toLowerCase(), + value, + data, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( destination: string, @@ -1798,28 +1654,29 @@ export class AssetProxyOwnerContract extends BaseContract { data: string, txData?: Partial | undefined, ): Promise { - assert.isString('destination', destination); - assert.isBigNumber('value', value); - assert.isString('data', data); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [destination.toLowerCase(), - value, - data - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('destination', destination); + assert.isBigNumber('value', value); + assert.isString('data', data); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [ + destination.toLowerCase(), + value, + data, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( destination: string, @@ -1827,8 +1684,7 @@ export class AssetProxyOwnerContract extends BaseContract { data: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('destination', destination); assert.isBigNumber('value', value); assert.isString('data', data); @@ -1840,11 +1696,12 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [destination.toLowerCase(), - value, - data - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [ + destination.toLowerCase(), + value, + data, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1853,30 +1710,28 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('submitTransaction(address,uint256,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - destination: string, - value: BigNumber, - data: string, - ): string { + getABIEncodedTransactionData(destination: string, value: BigNumber, data: string): string { assert.isString('destination', destination); assert.isBigNumber('value', value); assert.isString('data', data); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [destination.toLowerCase(), - value, - data - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [ + destination.toLowerCase(), + value, + data, + ]); return abiEncodedTransactionData; }, }; @@ -1885,8 +1740,7 @@ export class AssetProxyOwnerContract extends BaseContract { index_0: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1896,9 +1750,8 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('confirmationTimes(uint256)', [index_0 - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('confirmationTimes(uint256)', [index_0]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1907,33 +1760,27 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('confirmationTimes(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: BigNumber, - ): string { + getABIEncodedTransactionData(index_0: BigNumber): string { assert.isBigNumber('index_0', index_0); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('confirmationTimes(uint256)', [index_0 - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('confirmationTimes(uint256)', [index_0]); return abiEncodedTransactionData; }, }; public MAX_OWNER_COUNT = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -1942,7 +1789,7 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; + const self = (this as any) as AssetProxyOwnerContract; const encodedData = self._strictEncodeArguments('MAX_OWNER_COUNT()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1952,30 +1799,26 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('MAX_OWNER_COUNT()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as AssetProxyOwnerContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as AssetProxyOwnerContract; const abiEncodedTransactionData = self._strictEncodeArguments('MAX_OWNER_COUNT()', []); return abiEncodedTransactionData; }, }; public required = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -1984,7 +1827,7 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; + const self = (this as any) as AssetProxyOwnerContract; const encodedData = self._strictEncodeArguments('required()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1994,20 +1837,20 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('required()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as AssetProxyOwnerContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as AssetProxyOwnerContract; const abiEncodedTransactionData = self._strictEncodeArguments('required()', []); return abiEncodedTransactionData; }, @@ -2016,33 +1859,30 @@ export class AssetProxyOwnerContract extends BaseContract { async sendTransactionAsync( owner: string, newOwner: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('owner', owner); - assert.isString('newOwner', newOwner); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [owner.toLowerCase(), - newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.replaceOwner.estimateGasAsync.bind( - self, + assert.isString('owner', owner); + assert.isString('newOwner', newOwner); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [ owner.toLowerCase(), - newOwner.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + newOwner.toLowerCase(), + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.replaceOwner.estimateGasAsync.bind(self, owner.toLowerCase(), newOwner.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( owner: string, @@ -2051,57 +1891,55 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('owner', owner); - assert.isString('newOwner', newOwner); - const self = this as any as AssetProxyOwnerContract; - const txHashPromise = self.replaceOwner.sendTransactionAsync(owner.toLowerCase(), - newOwner.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('owner', owner); + assert.isString('newOwner', newOwner); + const self = (this as any) as AssetProxyOwnerContract; + const txHashPromise = self.replaceOwner.sendTransactionAsync( + owner.toLowerCase(), + newOwner.toLowerCase(), + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - owner: string, - newOwner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('owner', owner); - assert.isString('newOwner', newOwner); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [owner.toLowerCase(), - newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(owner: string, newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('owner', owner); + assert.isString('newOwner', newOwner); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [ + owner.toLowerCase(), + newOwner.toLowerCase(), + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( owner: string, newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('owner', owner); assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -2112,10 +1950,11 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [owner.toLowerCase(), - newOwner.toLowerCase() - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [ + owner.toLowerCase(), + newOwner.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2124,57 +1963,49 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('replaceOwner(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - owner: string, - newOwner: string, - ): string { + getABIEncodedTransactionData(owner: string, newOwner: string): string { assert.isString('owner', owner); assert.isString('newOwner', newOwner); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('replaceOwner(address,address)', [owner.toLowerCase(), - newOwner.toLowerCase() - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('replaceOwner(address,address)', [ + owner.toLowerCase(), + newOwner.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public executeTransaction = { - async sendTransactionAsync( - transactionId: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.executeTransaction.estimateGasAsync.bind( - self, - transactionId - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(transactionId: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('transactionId', transactionId); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.executeTransaction.estimateGasAsync.bind(self, transactionId), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( transactionId: BigNumber, @@ -2182,51 +2013,45 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const txHashPromise = self.executeTransaction.sendTransactionAsync(transactionId - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('transactionId', transactionId); + const self = (this as any) as AssetProxyOwnerContract; + const txHashPromise = self.executeTransaction.sendTransactionAsync(transactionId, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - transactionId: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(transactionId: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('transactionId', transactionId); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( transactionId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('transactionId', transactionId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -2236,9 +2061,8 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2247,37 +2071,37 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('executeTransaction(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - transactionId: BigNumber, - ): string { + getABIEncodedTransactionData(transactionId: BigNumber): string { assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('executeTransaction(uint256)', [ + transactionId, + ]); return abiEncodedTransactionData; }, }; -private readonly _subscriptionManager: SubscriptionManager; -public static async deployFrom0xArtifactAsync( + private readonly _subscriptionManager: SubscriptionManager; + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, - _owners: string[], - _assetProxyContracts: string[], - _required: BigNumber, - _secondsTimeLocked: BigNumber, + artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + _owners: string[], + _assetProxyContracts: string[], + _required: BigNumber, + _secondsTimeLocked: BigNumber, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -2290,12 +2114,23 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); - return AssetProxyOwnerContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, _owners, -_assetProxyContracts, -_required, -_secondsTimeLocked -); + const abiDependencies = _.mapValues( + artifactDependencies, + (artifactDependency: ContractArtifact | SimpleContractArtifact) => { + return artifactDependency.compilerOutput.abi; + }, + ); + return AssetProxyOwnerContract.deployAsync( + bytecode, + abi, + provider, + txDefaults, + abiDependencies, + _owners, + _assetProxyContracts, + _required, + _secondsTimeLocked, + ); } public static async deployAsync( bytecode: string, @@ -2303,10 +2138,10 @@ _secondsTimeLocked supportedProvider: SupportedProvider, txDefaults: Partial, abiDependencies: { [contractName: string]: ContractAbi }, - _owners: string[], - _assetProxyContracts: string[], - _required: BigNumber, - _secondsTimeLocked: BigNumber, + _owners: string[], + _assetProxyContracts: string[], + _required: BigNumber, + _secondsTimeLocked: BigNumber, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -2316,29 +2151,17 @@ _secondsTimeLocked ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_owners, -_assetProxyContracts, -_required, -_secondsTimeLocked -] = BaseContract._formatABIDataItemList( + [_owners, _assetProxyContracts, _required, _secondsTimeLocked] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [_owners, -_assetProxyContracts, -_required, -_secondsTimeLocked -], + [_owners, _assetProxyContracts, _required, _secondsTimeLocked], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_owners, -_assetProxyContracts, -_required, -_secondsTimeLocked -]); + const txData = deployInfo.encode(bytecode, [_owners, _assetProxyContracts, _required, _secondsTimeLocked]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -2346,22 +2169,22 @@ _secondsTimeLocked logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`AssetProxyOwner successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new AssetProxyOwnerContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); - contractInstance.constructorArgs = [_owners, -_assetProxyContracts, -_required, -_secondsTimeLocked -]; + const contractInstance = new AssetProxyOwnerContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + abiDependencies, + ); + contractInstance.constructorArgs = [_owners, _assetProxyContracts, _required, _secondsTimeLocked]; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -2380,7 +2203,7 @@ _secondsTimeLocked stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2389,13 +2212,12 @@ _secondsTimeLocked }, ], name: 'removeOwner', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2404,13 +2226,12 @@ _secondsTimeLocked }, ], name: 'revokeConfirmation', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2429,7 +2250,7 @@ _secondsTimeLocked stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2452,7 +2273,7 @@ _secondsTimeLocked stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2461,16 +2282,14 @@ _secondsTimeLocked }, ], name: 'executeRemoveAuthorizedAddressAtIndex', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'secondsTimeLocked', outputs: [ { @@ -2482,7 +2301,7 @@ _secondsTimeLocked stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2505,7 +2324,7 @@ _secondsTimeLocked stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2518,13 +2337,12 @@ _secondsTimeLocked }, ], name: 'registerAssetProxy', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2533,13 +2351,12 @@ _secondsTimeLocked }, ], name: 'addOwner', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2558,7 +2375,7 @@ _secondsTimeLocked stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2567,13 +2384,12 @@ _secondsTimeLocked }, ], name: 'changeTimeLock', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2592,7 +2408,7 @@ _secondsTimeLocked stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2611,7 +2427,7 @@ _secondsTimeLocked stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2642,10 +2458,9 @@ _secondsTimeLocked stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'getOwners', outputs: [ { @@ -2657,7 +2472,7 @@ _secondsTimeLocked stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2688,7 +2503,7 @@ _secondsTimeLocked stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2707,10 +2522,9 @@ _secondsTimeLocked stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'transactionCount', outputs: [ { @@ -2722,7 +2536,7 @@ _secondsTimeLocked stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2731,13 +2545,12 @@ _secondsTimeLocked }, ], name: 'changeRequirement', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2746,13 +2559,12 @@ _secondsTimeLocked }, ], name: 'confirmTransaction', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2779,7 +2591,7 @@ _secondsTimeLocked stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2798,10 +2610,9 @@ _secondsTimeLocked stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'MAX_OWNER_COUNT', outputs: [ { @@ -2813,10 +2624,9 @@ _secondsTimeLocked stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'required', outputs: [ { @@ -2828,7 +2638,7 @@ _secondsTimeLocked stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2841,13 +2651,12 @@ _secondsTimeLocked }, ], name: 'replaceOwner', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2856,13 +2665,12 @@ _secondsTimeLocked }, ], name: 'executeTransaction', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { inputs: [ { name: '_owners', @@ -2881,22 +2689,19 @@ _secondsTimeLocked type: 'uint256', }, ], - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'constructor', }, - { - inputs: [ - ], - outputs: [ - ], + { + inputs: [], + outputs: [], payable: true, stateMutability: 'payable', type: 'fallback', }, - { + { anonymous: false, inputs: [ { @@ -2911,11 +2716,10 @@ _secondsTimeLocked }, ], name: 'AssetProxyRegistration', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -2930,11 +2734,10 @@ _secondsTimeLocked }, ], name: 'ConfirmationTimeSet', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -2944,11 +2747,10 @@ _secondsTimeLocked }, ], name: 'TimeLockChange', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -2963,11 +2765,10 @@ _secondsTimeLocked }, ], name: 'Confirmation', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -2982,11 +2783,10 @@ _secondsTimeLocked }, ], name: 'Revocation', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -2996,11 +2796,10 @@ _secondsTimeLocked }, ], name: 'Submission', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -3010,11 +2809,10 @@ _secondsTimeLocked }, ], name: 'Execution', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -3024,11 +2822,10 @@ _secondsTimeLocked }, ], name: 'ExecutionFailure', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -3043,11 +2840,10 @@ _secondsTimeLocked }, ], name: 'Deposit', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -3057,11 +2853,10 @@ _secondsTimeLocked }, ], name: 'OwnerAddition', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -3071,11 +2866,10 @@ _secondsTimeLocked }, ], name: 'OwnerRemoval', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -3085,8 +2879,7 @@ _secondsTimeLocked }, ], name: 'RequirementChange', - outputs: [ - ], + outputs: [], type: 'event', }, ] as ContractAbi; @@ -3160,15 +2953,27 @@ _secondsTimeLocked ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { - super('AssetProxyOwner', AssetProxyOwnerContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { + super( + 'AssetProxyOwner', + AssetProxyOwnerContract.ABI(), + address, + supportedProvider, + txDefaults, + logDecodeDependencies, + ); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( AssetProxyOwnerContract.ABI(), this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts index e708dedb7e..56f9d09e2b 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts @@ -1,7 +1,7 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract,PromiseWithTransactionHash } from '@0x/base-contract'; +import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -24,7 +24,6 @@ import * as ethers from 'ethers'; import * as _ from 'lodash'; // tslint:enable:no-unused-variable - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name @@ -35,8 +34,7 @@ export class CoordinatorContract extends BaseContract { signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('hash', hash); assert.isString('signature', signature); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -47,10 +45,8 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as CoordinatorContract; - const encodedData = self._strictEncodeArguments('getSignerAddress(bytes32,bytes)', [hash, - signature - ]); + const self = (this as any) as CoordinatorContract; + const encodedData = self._strictEncodeArguments('getSignerAddress(bytes32,bytes)', [hash, signature]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -59,38 +55,35 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getSignerAddress(bytes32,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - hash: string, - signature: string, - ): string { + getABIEncodedTransactionData(hash: string, signature: string): string { assert.isString('hash', hash); assert.isString('signature', signature); - const self = this as any as CoordinatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getSignerAddress(bytes32,bytes)', [hash, - signature - ]); + const self = (this as any) as CoordinatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getSignerAddress(bytes32,bytes)', [ + hash, + signature, + ]); return abiEncodedTransactionData; }, }; public getTransactionHash = { async callAsync( - transaction: {salt: BigNumber;signerAddress: string;data: string}, + transaction: { salt: BigNumber; signerAddress: string; data: string }, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { - + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -99,9 +92,10 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as CoordinatorContract; - const encodedData = self._strictEncodeArguments('getTransactionHash((uint256,address,bytes))', [transaction - ]); + const self = (this as any) as CoordinatorContract; + const encodedData = self._strictEncodeArguments('getTransactionHash((uint256,address,bytes))', [ + transaction, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -110,35 +104,38 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + 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); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - transaction: {salt: BigNumber;signerAddress: string;data: string}, - ): string { - - const self = this as any as CoordinatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getTransactionHash((uint256,address,bytes))', [transaction - ]); + getABIEncodedTransactionData(transaction: { salt: BigNumber; signerAddress: string; data: string }): string { + const self = (this as any) as CoordinatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'getTransactionHash((uint256,address,bytes))', + [transaction], + ); return abiEncodedTransactionData; }, }; public getCoordinatorApprovalHash = { async callAsync( - approval: {txOrigin: string;transactionHash: string;transactionSignature: string;approvalExpirationTimeSeconds: BigNumber}, + approval: { + txOrigin: string; + transactionHash: string; + transactionSignature: string; + approvalExpirationTimeSeconds: BigNumber; + }, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { - + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -147,9 +144,11 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as CoordinatorContract; - const encodedData = self._strictEncodeArguments('getCoordinatorApprovalHash((address,bytes32,bytes,uint256))', [approval - ]); + 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, @@ -158,73 +157,81 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + 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); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - approval: {txOrigin: string;transactionHash: string;transactionSignature: string;approvalExpirationTimeSeconds: BigNumber}, - ): string { - - const self = this as any as CoordinatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getCoordinatorApprovalHash((address,bytes32,bytes,uint256))', [approval - ]); + getABIEncodedTransactionData(approval: { + txOrigin: string; + transactionHash: string; + transactionSignature: string; + approvalExpirationTimeSeconds: BigNumber; + }): string { + const self = (this as any) as CoordinatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'getCoordinatorApprovalHash((address,bytes32,bytes,uint256))', + [approval], + ); return abiEncodedTransactionData; }, }; public executeTransaction = { async sendTransactionAsync( - transaction: {salt: BigNumber;signerAddress: string;data: string}, + transaction: { salt: BigNumber; signerAddress: string; data: string }, txOrigin: string, transactionSignature: string, approvalExpirationTimeSeconds: BigNumber[], approvalSignatures: string[], - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - - assert.isString('txOrigin', txOrigin); - assert.isString('transactionSignature', transactionSignature); - assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); - assert.isArray('approvalSignatures', approvalSignatures); - const self = this as any as CoordinatorContract; - const encodedData = self._strictEncodeArguments('executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.executeTransaction.estimateGasAsync.bind( - self, - transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isString('txOrigin', txOrigin); + assert.isString('transactionSignature', transactionSignature); + assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); + assert.isArray('approvalSignatures', approvalSignatures); + const self = (this as any) as CoordinatorContract; + const encodedData = self._strictEncodeArguments( + 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', + [ + transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures, + ], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.executeTransaction.estimateGasAsync.bind( + self, + transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures, + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - transaction: {salt: BigNumber;signerAddress: string;data: string}, + transaction: { salt: BigNumber; signerAddress: string; data: string }, txOrigin: string, transactionSignature: string, approvalExpirationTimeSeconds: BigNumber[], @@ -233,76 +240,78 @@ export class CoordinatorContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - - assert.isString('txOrigin', txOrigin); - assert.isString('transactionSignature', transactionSignature); - assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); - assert.isArray('approvalSignatures', approvalSignatures); - const self = this as any as CoordinatorContract; - const txHashPromise = self.executeTransaction.sendTransactionAsync(transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('txOrigin', txOrigin); + assert.isString('transactionSignature', transactionSignature); + assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); + assert.isArray('approvalSignatures', approvalSignatures); + const self = (this as any) as CoordinatorContract; + const txHashPromise = self.executeTransaction.sendTransactionAsync( + transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - transaction: {salt: BigNumber;signerAddress: string;data: string}, + transaction: { salt: BigNumber; signerAddress: string; data: string }, txOrigin: string, transactionSignature: string, approvalExpirationTimeSeconds: BigNumber[], approvalSignatures: string[], txData?: Partial | undefined, ): Promise { - - assert.isString('txOrigin', txOrigin); - assert.isString('transactionSignature', transactionSignature); - assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); - assert.isArray('approvalSignatures', approvalSignatures); - const self = this as any as CoordinatorContract; - const encodedData = self._strictEncodeArguments('executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('txOrigin', txOrigin); + assert.isString('transactionSignature', transactionSignature); + assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); + assert.isArray('approvalSignatures', approvalSignatures); + const self = (this as any) as CoordinatorContract; + const encodedData = self._strictEncodeArguments( + 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', + [ + transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures, + ], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - transaction: {salt: BigNumber;signerAddress: string;data: string}, + transaction: { salt: BigNumber; signerAddress: string; data: string }, txOrigin: string, transactionSignature: string, approvalExpirationTimeSeconds: BigNumber[], approvalSignatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { - + ): Promise { assert.isString('txOrigin', txOrigin); assert.isString('transactionSignature', transactionSignature); assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); @@ -315,13 +324,17 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as CoordinatorContract; - const encodedData = self._strictEncodeArguments('executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures - ]); + const self = (this as any) as CoordinatorContract; + const encodedData = self._strictEncodeArguments( + 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', + [ + transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures, + ], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -330,45 +343,47 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])'); + const abiEncoder = self._lookupAbiEncoder( + 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - transaction: {salt: BigNumber;signerAddress: string;data: string}, - txOrigin: string, - transactionSignature: string, - approvalExpirationTimeSeconds: BigNumber[], - approvalSignatures: string[], - ): string { - + transaction: { salt: BigNumber; signerAddress: string; data: string }, + txOrigin: string, + transactionSignature: string, + approvalExpirationTimeSeconds: BigNumber[], + approvalSignatures: string[], + ): string { assert.isString('txOrigin', txOrigin); assert.isString('transactionSignature', transactionSignature); assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); assert.isArray('approvalSignatures', approvalSignatures); - const self = this as any as CoordinatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures - ]); + const self = (this as any) as CoordinatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', + [ + transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures, + ], + ); return abiEncodedTransactionData; }, }; public EIP712_EXCHANGE_DOMAIN_HASH = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -377,7 +392,7 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as CoordinatorContract; + const self = (this as any) as CoordinatorContract; const encodedData = self._strictEncodeArguments('EIP712_EXCHANGE_DOMAIN_HASH()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -387,36 +402,34 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + 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); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as CoordinatorContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as CoordinatorContract; const abiEncodedTransactionData = self._strictEncodeArguments('EIP712_EXCHANGE_DOMAIN_HASH()', []); return abiEncodedTransactionData; }, }; public assertValidCoordinatorApprovals = { async callAsync( - transaction: {salt: BigNumber;signerAddress: string;data: string}, + transaction: { salt: BigNumber; signerAddress: string; data: string }, txOrigin: string, transactionSignature: string, approvalExpirationTimeSeconds: BigNumber[], approvalSignatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { - + ): Promise { assert.isString('txOrigin', txOrigin); assert.isString('transactionSignature', transactionSignature); assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); @@ -429,13 +442,17 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as CoordinatorContract; - const encodedData = self._strictEncodeArguments('assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures - ]); + const self = (this as any) as CoordinatorContract; + const encodedData = self._strictEncodeArguments( + 'assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', + [ + transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures, + ], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -444,36 +461,42 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])'); + const abiEncoder = self._lookupAbiEncoder( + 'assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - transaction: {salt: BigNumber;signerAddress: string;data: string}, - txOrigin: string, - transactionSignature: string, - approvalExpirationTimeSeconds: BigNumber[], - approvalSignatures: string[], - ): string { - + transaction: { salt: BigNumber; signerAddress: string; data: string }, + txOrigin: string, + transactionSignature: string, + approvalExpirationTimeSeconds: BigNumber[], + approvalSignatures: string[], + ): string { assert.isString('txOrigin', txOrigin); assert.isString('transactionSignature', transactionSignature); assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); assert.isArray('approvalSignatures', approvalSignatures); - const self = this as any as CoordinatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures - ]); + const self = (this as any) as CoordinatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', + [ + transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures, + ], + ); return abiEncodedTransactionData; }, }; @@ -482,7 +505,21 @@ export class CoordinatorContract extends BaseContract { data: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise + ): Promise< + Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }> > { assert.isString('data', data); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -493,9 +530,8 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as CoordinatorContract; - const encodedData = self._strictEncodeArguments('decodeOrdersFromFillData(bytes)', [data - ]); + const self = (this as any) as CoordinatorContract; + const encodedData = self._strictEncodeArguments('decodeOrdersFromFillData(bytes)', [data]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -504,33 +540,42 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('decodeOrdersFromFillData(bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue< + Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }> + >(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - data: string, - ): string { + getABIEncodedTransactionData(data: string): string { assert.isString('data', data); - const self = this as any as CoordinatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('decodeOrdersFromFillData(bytes)', [data - ]); + const self = (this as any) as CoordinatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('decodeOrdersFromFillData(bytes)', [data]); return abiEncodedTransactionData; }, }; public EIP712_COORDINATOR_DOMAIN_HASH = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -539,7 +584,7 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as CoordinatorContract; + const self = (this as any) as CoordinatorContract; const encodedData = self._strictEncodeArguments('EIP712_COORDINATOR_DOMAIN_HASH()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -549,30 +594,30 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('EIP712_COORDINATOR_DOMAIN_HASH()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as CoordinatorContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as CoordinatorContract; const abiEncodedTransactionData = self._strictEncodeArguments('EIP712_COORDINATOR_DOMAIN_HASH()', []); return abiEncodedTransactionData; }, }; -public static async deployFrom0xArtifactAsync( + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, - _exchange: string, + artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + _exchange: string, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -585,9 +630,13 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); - return CoordinatorContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, _exchange -); + const abiDependencies = _.mapValues( + artifactDependencies, + (artifactDependency: ContractArtifact | SimpleContractArtifact) => { + return artifactDependency.compilerOutput.abi; + }, + ); + return CoordinatorContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, _exchange); } public static async deployAsync( bytecode: string, @@ -595,7 +644,7 @@ public static async deployFrom0xArtifactAsync( supportedProvider: SupportedProvider, txDefaults: Partial, abiDependencies: { [contractName: string]: ContractAbi }, - _exchange: string, + _exchange: string, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -605,20 +654,17 @@ public static async deployFrom0xArtifactAsync( ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_exchange -] = BaseContract._formatABIDataItemList( + [_exchange] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [_exchange -], + [_exchange], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_exchange -]); + const txData = deployInfo.encode(bytecode, [_exchange]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -626,19 +672,22 @@ public static async deployFrom0xArtifactAsync( logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`Coordinator successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new CoordinatorContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); - contractInstance.constructorArgs = [_exchange -]; + const contractInstance = new CoordinatorContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + abiDependencies, + ); + contractInstance.constructorArgs = [_exchange]; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -661,7 +710,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'pure', type: 'function', }, - { + { constant: true, inputs: [ { @@ -680,7 +729,7 @@ public static async deployFrom0xArtifactAsync( name: 'data', type: 'bytes', }, - ] + ], }, ], name: 'getTransactionHash', @@ -694,7 +743,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -717,7 +766,7 @@ public static async deployFrom0xArtifactAsync( name: 'approvalExpirationTimeSeconds', type: 'uint256', }, - ] + ], }, ], name: 'getCoordinatorApprovalHash', @@ -731,7 +780,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -750,7 +799,7 @@ public static async deployFrom0xArtifactAsync( name: 'data', type: 'bytes', }, - ] + ], }, { name: 'txOrigin', @@ -770,16 +819,14 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'executeTransaction', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'EIP712_EXCHANGE_DOMAIN_HASH', outputs: [ { @@ -791,7 +838,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -810,7 +857,7 @@ public static async deployFrom0xArtifactAsync( name: 'data', type: 'bytes', }, - ] + ], }, { name: 'txOrigin', @@ -830,13 +877,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'assertValidCoordinatorApprovals', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -898,17 +944,16 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, ], payable: false, stateMutability: 'pure', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'EIP712_COORDINATOR_DOMAIN_HASH', outputs: [ { @@ -920,15 +965,14 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { inputs: [ { name: '_exchange', type: 'address', }, ], - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'constructor', @@ -936,11 +980,16 @@ public static async deployFrom0xArtifactAsync( ] as ContractAbi; return abi; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { super('Coordinator', CoordinatorContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 1783c8969d..9f11a590c3 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts @@ -1,11 +1,14 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, +import { + BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; + SubscriptionManager, + PromiseWithTransactionHash, +} from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -29,8 +32,7 @@ import * as ethers from 'ethers'; import * as _ from 'lodash'; // tslint:enable:no-unused-variable -export type CoordinatorRegistryEventArgs = - | CoordinatorRegistryCoordinatorEndpointSetEventArgs; +export type CoordinatorRegistryEventArgs = CoordinatorRegistryCoordinatorEndpointSetEventArgs; export enum CoordinatorRegistryEvents { CoordinatorEndpointSet = 'CoordinatorEndpointSet', @@ -41,38 +43,30 @@ export interface CoordinatorRegistryCoordinatorEndpointSetEventArgs extends Deco coordinatorEndpoint: string; } - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class CoordinatorRegistryContract extends BaseContract { public setCoordinatorEndpoint = { - async sendTransactionAsync( - coordinatorEndpoint: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('coordinatorEndpoint', coordinatorEndpoint); - const self = this as any as CoordinatorRegistryContract; - const encodedData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.setCoordinatorEndpoint.estimateGasAsync.bind( - self, - coordinatorEndpoint - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(coordinatorEndpoint: string, txData?: Partial | undefined): Promise { + assert.isString('coordinatorEndpoint', coordinatorEndpoint); + const self = (this as any) as CoordinatorRegistryContract; + const encodedData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.setCoordinatorEndpoint.estimateGasAsync.bind(self, coordinatorEndpoint), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( coordinatorEndpoint: string, @@ -80,51 +74,45 @@ export class CoordinatorRegistryContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('coordinatorEndpoint', coordinatorEndpoint); - const self = this as any as CoordinatorRegistryContract; - const txHashPromise = self.setCoordinatorEndpoint.sendTransactionAsync(coordinatorEndpoint - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('coordinatorEndpoint', coordinatorEndpoint); + const self = (this as any) as CoordinatorRegistryContract; + const txHashPromise = self.setCoordinatorEndpoint.sendTransactionAsync(coordinatorEndpoint, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - coordinatorEndpoint: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('coordinatorEndpoint', coordinatorEndpoint); - const self = this as any as CoordinatorRegistryContract; - const encodedData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(coordinatorEndpoint: string, txData?: Partial | undefined): Promise { + assert.isString('coordinatorEndpoint', coordinatorEndpoint); + const self = (this as any) as CoordinatorRegistryContract; + const encodedData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( coordinatorEndpoint: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('coordinatorEndpoint', coordinatorEndpoint); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -134,9 +122,8 @@ export class CoordinatorRegistryContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as CoordinatorRegistryContract; - const encodedData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint - ]); + const self = (this as any) as CoordinatorRegistryContract; + const encodedData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -145,24 +132,24 @@ export class CoordinatorRegistryContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('setCoordinatorEndpoint(string)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - coordinatorEndpoint: string, - ): string { + getABIEncodedTransactionData(coordinatorEndpoint: string): string { assert.isString('coordinatorEndpoint', coordinatorEndpoint); - const self = this as any as CoordinatorRegistryContract; - const abiEncodedTransactionData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint - ]); + const self = (this as any) as CoordinatorRegistryContract; + const abiEncodedTransactionData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [ + coordinatorEndpoint, + ]); return abiEncodedTransactionData; }, }; @@ -171,8 +158,7 @@ export class CoordinatorRegistryContract extends BaseContract { coordinatorOperator: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('coordinatorOperator', coordinatorOperator); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -182,9 +168,10 @@ export class CoordinatorRegistryContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as CoordinatorRegistryContract; - const encodedData = self._strictEncodeArguments('getCoordinatorEndpoint(address)', [coordinatorOperator.toLowerCase() - ]); + const self = (this as any) as CoordinatorRegistryContract; + const encodedData = self._strictEncodeArguments('getCoordinatorEndpoint(address)', [ + coordinatorOperator.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -193,33 +180,33 @@ export class CoordinatorRegistryContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getCoordinatorEndpoint(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - coordinatorOperator: string, - ): string { + getABIEncodedTransactionData(coordinatorOperator: string): string { assert.isString('coordinatorOperator', coordinatorOperator); - const self = this as any as CoordinatorRegistryContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getCoordinatorEndpoint(address)', [coordinatorOperator.toLowerCase() - ]); + const self = (this as any) as CoordinatorRegistryContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getCoordinatorEndpoint(address)', [ + coordinatorOperator.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; -private readonly _subscriptionManager: SubscriptionManager; -public static async deployFrom0xArtifactAsync( + private readonly _subscriptionManager: SubscriptionManager; + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -232,8 +219,13 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); - return CoordinatorRegistryContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, ); + const abiDependencies = _.mapValues( + artifactDependencies, + (artifactDependency: ContractArtifact | SimpleContractArtifact) => { + return artifactDependency.compilerOutput.abi; + }, + ); + return CoordinatorRegistryContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies); } public static async deployAsync( bytecode: string, @@ -250,17 +242,13 @@ public static async deployFrom0xArtifactAsync( ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); + [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -268,18 +256,22 @@ public static async deployFrom0xArtifactAsync( logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`CoordinatorRegistry successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new CoordinatorRegistryContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); + const contractInstance = new CoordinatorRegistryContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + abiDependencies, + ); contractInstance.constructorArgs = []; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: false, inputs: [ { @@ -288,13 +280,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'setCoordinatorEndpoint', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -313,16 +304,14 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { - inputs: [ - ], - outputs: [ - ], + { + inputs: [], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'constructor', }, - { + { anonymous: false, inputs: [ { @@ -337,8 +326,7 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'CoordinatorEndpointSet', - outputs: [ - ], + outputs: [], type: 'event', }, ] as ContractAbi; @@ -412,15 +400,27 @@ public static async deployFrom0xArtifactAsync( ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { - super('CoordinatorRegistry', CoordinatorRegistryContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { + super( + 'CoordinatorRegistry', + CoordinatorRegistryContract.ABI(), + address, + supportedProvider, + txDefaults, + logDecodeDependencies, + ); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( CoordinatorRegistryContract.ABI(), this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 e46d11a383..573127280a 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 @@ -1,11 +1,14 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, +import { + BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; + SubscriptionManager, + PromiseWithTransactionHash, +} from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -29,9 +32,7 @@ import * as ethers from 'ethers'; import * as _ from 'lodash'; // tslint:enable:no-unused-variable -export type DummyERC20TokenEventArgs = - | DummyERC20TokenTransferEventArgs - | DummyERC20TokenApprovalEventArgs; +export type DummyERC20TokenEventArgs = DummyERC20TokenTransferEventArgs | DummyERC20TokenApprovalEventArgs; export enum DummyERC20TokenEvents { Transfer = 'Transfer', @@ -50,17 +51,12 @@ export interface DummyERC20TokenApprovalEventArgs extends DecodedLogArgs { _value: BigNumber; } - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class DummyERC20TokenContract extends BaseContract { public name = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -69,7 +65,7 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC20TokenContract; + const self = (this as any) as DummyERC20TokenContract; const encodedData = self._strictEncodeArguments('name()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -79,20 +75,20 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('name()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as DummyERC20TokenContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as DummyERC20TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('name()', []); return abiEncodedTransactionData; }, @@ -101,33 +97,30 @@ export class DummyERC20TokenContract extends BaseContract { async sendTransactionAsync( _spender: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind( - self, + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ _spender.toLowerCase(), - _value - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _value, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.approve.estimateGasAsync.bind(self, _spender.toLowerCase(), _value), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _spender: string, @@ -136,57 +129,55 @@ export class DummyERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const txHashPromise = self.approve.sendTransactionAsync(_spender.toLowerCase(), - _value - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = (this as any) as DummyERC20TokenContract; + const txHashPromise = self.approve.sendTransactionAsync(_spender.toLowerCase(), _value, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _spender: string, _value: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + _spender.toLowerCase(), + _value, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _spender: string, _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -197,10 +188,11 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), - _value - ]); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + _spender.toLowerCase(), + _value, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -209,36 +201,31 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _spender: string, - _value: BigNumber, - ): string { + getABIEncodedTransactionData(_spender: string, _value: BigNumber): string { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), - _value - ]); + const self = (this as any) as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [ + _spender.toLowerCase(), + _value, + ]); return abiEncodedTransactionData; }, }; public totalSupply = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -247,7 +234,7 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC20TokenContract; + const self = (this as any) as DummyERC20TokenContract; const encodedData = self._strictEncodeArguments('totalSupply()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -257,20 +244,20 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('totalSupply()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as DummyERC20TokenContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as DummyERC20TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('totalSupply()', []); return abiEncodedTransactionData; }, @@ -280,36 +267,32 @@ export class DummyERC20TokenContract extends BaseContract { _from: string, _to: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind( - self, + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ _from.toLowerCase(), _to.toLowerCase(), - _value - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _value, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferFrom.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _value), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -319,25 +302,27 @@ export class DummyERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const txHashPromise = self.transferFrom.sendTransactionAsync(_from.toLowerCase(), - _to.toLowerCase(), - _value - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as DummyERC20TokenContract; + const txHashPromise = self.transferFrom.sendTransactionAsync( + _from.toLowerCase(), + _to.toLowerCase(), + _value, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -345,28 +330,29 @@ export class DummyERC20TokenContract extends BaseContract { _value: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _value, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -374,8 +360,7 @@ export class DummyERC20TokenContract extends BaseContract { _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_value', _value); @@ -387,11 +372,12 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _value - ]); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _value, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -400,39 +386,33 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _value: BigNumber, - ): string { + getABIEncodedTransactionData(_from: string, _to: string, _value: BigNumber): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _value - ]); + const self = (this as any) as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _value, + ]); return abiEncodedTransactionData; }, }; public decimals = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -441,7 +421,7 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC20TokenContract; + const self = (this as any) as DummyERC20TokenContract; const encodedData = self._strictEncodeArguments('decimals()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -451,20 +431,20 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('decimals()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as DummyERC20TokenContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as DummyERC20TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('decimals()', []); return abiEncodedTransactionData; }, @@ -474,8 +454,7 @@ export class DummyERC20TokenContract extends BaseContract { _owner: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -485,9 +464,8 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() - ]); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -496,33 +474,27 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _owner: string, - ): string { + getABIEncodedTransactionData(_owner: string): string { assert.isString('_owner', _owner); - const self = this as any as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() - ]); + const self = (this as any) as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); return abiEncodedTransactionData; }, }; public owner = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -531,7 +503,7 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC20TokenContract; + const self = (this as any) as DummyERC20TokenContract; const encodedData = self._strictEncodeArguments('owner()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -541,30 +513,26 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as DummyERC20TokenContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as DummyERC20TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); return abiEncodedTransactionData; }, }; public symbol = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -573,7 +541,7 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC20TokenContract; + const self = (this as any) as DummyERC20TokenContract; const encodedData = self._strictEncodeArguments('symbol()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -583,51 +551,44 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('symbol()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as DummyERC20TokenContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as DummyERC20TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('symbol()', []); return abiEncodedTransactionData; }, }; public mint = { - async sendTransactionAsync( - _value: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('mint(uint256)', [_value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.mint.estimateGasAsync.bind( - self, - _value - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(_value: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('_value', _value); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('mint(uint256)', [_value]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.mint.estimateGasAsync.bind(self, _value), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _value: BigNumber, @@ -635,51 +596,41 @@ export class DummyERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const txHashPromise = self.mint.sendTransactionAsync(_value - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('_value', _value); + const self = (this as any) as DummyERC20TokenContract; + const txHashPromise = self.mint.sendTransactionAsync(_value, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - _value: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('mint(uint256)', [_value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(_value: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('_value', _value); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('mint(uint256)', [_value]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - _value: BigNumber, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(_value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isBigNumber('_value', _value); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -689,9 +640,8 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('mint(uint256)', [_value - ]); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('mint(uint256)', [_value]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -700,24 +650,22 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('mint(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _value: BigNumber, - ): string { + getABIEncodedTransactionData(_value: BigNumber): string { assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('mint(uint256)', [_value - ]); + const self = (this as any) as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('mint(uint256)', [_value]); return abiEncodedTransactionData; }, }; @@ -725,33 +673,27 @@ export class DummyERC20TokenContract extends BaseContract { async sendTransactionAsync( _to: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transfer.estimateGasAsync.bind( - self, - _to.toLowerCase(), - _value - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transfer.estimateGasAsync.bind(self, _to.toLowerCase(), _value), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _to: string, @@ -760,57 +702,48 @@ export class DummyERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const txHashPromise = self.transfer.sendTransactionAsync(_to.toLowerCase(), - _value - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as DummyERC20TokenContract; + const txHashPromise = self.transfer.sendTransactionAsync(_to.toLowerCase(), _value, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - _to: string, - _value: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(_to: string, _value: BigNumber, txData?: Partial | undefined): Promise { + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _to: string, _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_to', _to); assert.isBigNumber('_value', _value); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -821,10 +754,8 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), - _value - ]); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -833,27 +764,26 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _to: string, - _value: BigNumber, - ): string { + getABIEncodedTransactionData(_to: string, _value: BigNumber): string { assert.isString('_to', _to); assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), - _value - ]); + const self = (this as any) as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [ + _to.toLowerCase(), + _value, + ]); return abiEncodedTransactionData; }, }; @@ -863,8 +793,7 @@ export class DummyERC20TokenContract extends BaseContract { _spender: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.isString('_spender', _spender); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -875,10 +804,11 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('allowance(address,address)', [_owner.toLowerCase(), - _spender.toLowerCase() - ]); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('allowance(address,address)', [ + _owner.toLowerCase(), + _spender.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -887,27 +817,26 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _owner: string, - _spender: string, - ): string { + getABIEncodedTransactionData(_owner: string, _spender: string): string { assert.isString('_owner', _owner); assert.isString('_spender', _spender); - const self = this as any as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [_owner.toLowerCase(), - _spender.toLowerCase() - ]); + const self = (this as any) as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [ + _owner.toLowerCase(), + _spender.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; @@ -915,33 +844,30 @@ export class DummyERC20TokenContract extends BaseContract { async sendTransactionAsync( _target: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_target', _target); - assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [_target.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.setBalance.estimateGasAsync.bind( - self, + assert.isString('_target', _target); + assert.isBigNumber('_value', _value); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [ _target.toLowerCase(), - _value - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _value, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.setBalance.estimateGasAsync.bind(self, _target.toLowerCase(), _value), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _target: string, @@ -950,57 +876,55 @@ export class DummyERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_target', _target); - assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const txHashPromise = self.setBalance.sendTransactionAsync(_target.toLowerCase(), - _value - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_target', _target); + assert.isBigNumber('_value', _value); + const self = (this as any) as DummyERC20TokenContract; + const txHashPromise = self.setBalance.sendTransactionAsync(_target.toLowerCase(), _value, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _target: string, _value: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_target', _target); - assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [_target.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_target', _target); + assert.isBigNumber('_value', _value); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [ + _target.toLowerCase(), + _value, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _target: string, _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_target', _target); assert.isBigNumber('_value', _value); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -1011,10 +935,11 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [_target.toLowerCase(), - _value - ]); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [ + _target.toLowerCase(), + _value, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1023,57 +948,49 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('setBalance(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _target: string, - _value: BigNumber, - ): string { + getABIEncodedTransactionData(_target: string, _value: BigNumber): string { assert.isString('_target', _target); assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('setBalance(address,uint256)', [_target.toLowerCase(), - _value - ]); + const self = (this as any) as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('setBalance(address,uint256)', [ + _target.toLowerCase(), + _value, + ]); return abiEncodedTransactionData; }, }; public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('newOwner', newOwner); - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind( - self, - newOwner.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( newOwner: string, @@ -1081,51 +998,41 @@ export class DummyERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('newOwner', newOwner); - const self = this as any as DummyERC20TokenContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('newOwner', newOwner); + const self = (this as any) as DummyERC20TokenContract; + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - newOwner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('newOwner', newOwner); - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - newOwner: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1135,9 +1042,8 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1146,33 +1052,29 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - newOwner: string, - ): string { + getABIEncodedTransactionData(newOwner: string): string { assert.isString('newOwner', newOwner); - const self = this as any as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); + const self = (this as any) as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ + newOwner.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public MAX_MINT_AMOUNT = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -1181,7 +1083,7 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC20TokenContract; + const self = (this as any) as DummyERC20TokenContract; const encodedData = self._strictEncodeArguments('MAX_MINT_AMOUNT()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1191,34 +1093,34 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('MAX_MINT_AMOUNT()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as DummyERC20TokenContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as DummyERC20TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('MAX_MINT_AMOUNT()', []); return abiEncodedTransactionData; }, }; -private readonly _subscriptionManager: SubscriptionManager; -public static async deployFrom0xArtifactAsync( + private readonly _subscriptionManager: SubscriptionManager; + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, - _name: string, - _symbol: string, - _decimals: BigNumber, - _totalSupply: BigNumber, + artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + _name: string, + _symbol: string, + _decimals: BigNumber, + _totalSupply: BigNumber, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -1231,12 +1133,23 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); - return DummyERC20TokenContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, _name, -_symbol, -_decimals, -_totalSupply -); + const abiDependencies = _.mapValues( + artifactDependencies, + (artifactDependency: ContractArtifact | SimpleContractArtifact) => { + return artifactDependency.compilerOutput.abi; + }, + ); + return DummyERC20TokenContract.deployAsync( + bytecode, + abi, + provider, + txDefaults, + abiDependencies, + _name, + _symbol, + _decimals, + _totalSupply, + ); } public static async deployAsync( bytecode: string, @@ -1244,10 +1157,10 @@ _totalSupply supportedProvider: SupportedProvider, txDefaults: Partial, abiDependencies: { [contractName: string]: ContractAbi }, - _name: string, - _symbol: string, - _decimals: BigNumber, - _totalSupply: BigNumber, + _name: string, + _symbol: string, + _decimals: BigNumber, + _totalSupply: BigNumber, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -1257,29 +1170,17 @@ _totalSupply ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_name, -_symbol, -_decimals, -_totalSupply -] = BaseContract._formatABIDataItemList( + [_name, _symbol, _decimals, _totalSupply] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [_name, -_symbol, -_decimals, -_totalSupply -], + [_name, _symbol, _decimals, _totalSupply], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_name, -_symbol, -_decimals, -_totalSupply -]); + const txData = deployInfo.encode(bytecode, [_name, _symbol, _decimals, _totalSupply]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -1287,25 +1188,24 @@ _totalSupply logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`DummyERC20Token successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new DummyERC20TokenContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); - contractInstance.constructorArgs = [_name, -_symbol, -_decimals, -_totalSupply -]; + const contractInstance = new DummyERC20TokenContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + abiDependencies, + ); + contractInstance.constructorArgs = [_name, _symbol, _decimals, _totalSupply]; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'name', outputs: [ { @@ -1317,7 +1217,7 @@ _totalSupply stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1340,10 +1240,9 @@ _totalSupply stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'totalSupply', outputs: [ { @@ -1355,7 +1254,7 @@ _totalSupply stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1382,10 +1281,9 @@ _totalSupply stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'decimals', outputs: [ { @@ -1397,7 +1295,7 @@ _totalSupply stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1416,10 +1314,9 @@ _totalSupply stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'owner', outputs: [ { @@ -1431,10 +1328,9 @@ _totalSupply stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'symbol', outputs: [ { @@ -1446,7 +1342,7 @@ _totalSupply stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1455,13 +1351,12 @@ _totalSupply }, ], name: 'mint', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1484,7 +1379,7 @@ _totalSupply stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1507,7 +1402,7 @@ _totalSupply stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1520,13 +1415,12 @@ _totalSupply }, ], name: 'setBalance', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1535,16 +1429,14 @@ _totalSupply }, ], name: 'transferOwnership', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'MAX_MINT_AMOUNT', outputs: [ { @@ -1556,7 +1448,7 @@ _totalSupply stateMutability: 'view', type: 'function', }, - { + { inputs: [ { name: '_name', @@ -1575,13 +1467,12 @@ _totalSupply type: 'uint256', }, ], - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'constructor', }, - { + { anonymous: false, inputs: [ { @@ -1601,11 +1492,10 @@ _totalSupply }, ], name: 'Transfer', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1625,8 +1515,7 @@ _totalSupply }, ], name: 'Approval', - outputs: [ - ], + outputs: [], type: 'event', }, ] as ContractAbi; @@ -1700,15 +1589,27 @@ _totalSupply ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { - super('DummyERC20Token', DummyERC20TokenContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { + super( + 'DummyERC20Token', + DummyERC20TokenContract.ABI(), + address, + supportedProvider, + txDefaults, + logDecodeDependencies, + ); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( DummyERC20TokenContract.ABI(), this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 095e6bfb3f..03ad59fe4e 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 @@ -1,11 +1,14 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, +import { + BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; + SubscriptionManager, + PromiseWithTransactionHash, +} from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -58,17 +61,12 @@ export interface DummyERC721TokenApprovalForAllEventArgs extends DecodedLogArgs _approved: boolean; } - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class DummyERC721TokenContract extends BaseContract { public name = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -77,7 +75,7 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC721TokenContract; + const self = (this as any) as DummyERC721TokenContract; const encodedData = self._strictEncodeArguments('name()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -87,20 +85,20 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('name()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as DummyERC721TokenContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as DummyERC721TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('name()', []); return abiEncodedTransactionData; }, @@ -110,8 +108,7 @@ export class DummyERC721TokenContract extends BaseContract { _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('_tokenId', _tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -121,9 +118,8 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId - ]); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -132,24 +128,22 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getApproved(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _tokenId: BigNumber, - ): string { + getABIEncodedTransactionData(_tokenId: BigNumber): string { assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId - ]); + const self = (this as any) as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId]); return abiEncodedTransactionData; }, }; @@ -157,33 +151,30 @@ export class DummyERC721TokenContract extends BaseContract { async sendTransactionAsync( _approved: string, _tokenId: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_approved', _approved); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(), - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind( - self, + assert.isString('_approved', _approved); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ _approved.toLowerCase(), - _tokenId - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _tokenId, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.approve.estimateGasAsync.bind(self, _approved.toLowerCase(), _tokenId), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _approved: string, @@ -192,57 +183,55 @@ export class DummyERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_approved', _approved); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const txHashPromise = self.approve.sendTransactionAsync(_approved.toLowerCase(), - _tokenId - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_approved', _approved); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as DummyERC721TokenContract; + const txHashPromise = self.approve.sendTransactionAsync(_approved.toLowerCase(), _tokenId, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _approved: string, _tokenId: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_approved', _approved); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(), - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_approved', _approved); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + _approved.toLowerCase(), + _tokenId, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _approved: string, _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_approved', _approved); assert.isBigNumber('_tokenId', _tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -253,10 +242,11 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(), - _tokenId - ]); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + _approved.toLowerCase(), + _tokenId, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -265,27 +255,26 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _approved: string, - _tokenId: BigNumber, - ): string { + getABIEncodedTransactionData(_approved: string, _tokenId: BigNumber): string { assert.isString('_approved', _approved); assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(), - _tokenId - ]); + const self = (this as any) as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [ + _approved.toLowerCase(), + _tokenId, + ]); return abiEncodedTransactionData; }, }; @@ -294,36 +283,32 @@ export class DummyERC721TokenContract extends BaseContract { _from: string, _to: string, _tokenId: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind( - self, + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ _from.toLowerCase(), _to.toLowerCase(), - _tokenId - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _tokenId, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferFrom.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _tokenId), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -333,25 +318,27 @@ export class DummyERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const txHashPromise = self.transferFrom.sendTransactionAsync(_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as DummyERC721TokenContract; + const txHashPromise = self.transferFrom.sendTransactionAsync( + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -359,28 +346,29 @@ export class DummyERC721TokenContract extends BaseContract { _tokenId: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -388,8 +376,7 @@ export class DummyERC721TokenContract extends BaseContract { _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); @@ -401,11 +388,12 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - ]); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -414,30 +402,28 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _tokenId: BigNumber, - ): string { + getABIEncodedTransactionData(_from: string, _to: string, _tokenId: BigNumber): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - ]); + const self = (this as any) as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + ]); return abiEncodedTransactionData; }, }; @@ -445,33 +431,27 @@ export class DummyERC721TokenContract extends BaseContract { async sendTransactionAsync( _to: string, _tokenId: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to.toLowerCase(), - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.mint.estimateGasAsync.bind( - self, - _to.toLowerCase(), - _tokenId - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to.toLowerCase(), _tokenId]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.mint.estimateGasAsync.bind(self, _to.toLowerCase(), _tokenId), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _to: string, @@ -480,57 +460,52 @@ export class DummyERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const txHashPromise = self.mint.sendTransactionAsync(_to.toLowerCase(), - _tokenId - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as DummyERC721TokenContract; + const txHashPromise = self.mint.sendTransactionAsync(_to.toLowerCase(), _tokenId, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _to: string, _tokenId: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to.toLowerCase(), - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to.toLowerCase(), _tokenId]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _to: string, _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -541,10 +516,8 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to.toLowerCase(), - _tokenId - ]); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to.toLowerCase(), _tokenId]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -553,27 +526,26 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('mint(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _to: string, - _tokenId: BigNumber, - ): string { + getABIEncodedTransactionData(_to: string, _tokenId: BigNumber): string { assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('mint(address,uint256)', [_to.toLowerCase(), - _tokenId - ]); + const self = (this as any) as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('mint(address,uint256)', [ + _to.toLowerCase(), + _tokenId, + ]); return abiEncodedTransactionData; }, }; @@ -582,36 +554,32 @@ export class DummyERC721TokenContract extends BaseContract { _from: string, _to: string, _tokenId: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.safeTransferFrom1.estimateGasAsync.bind( - self, + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ _from.toLowerCase(), _to.toLowerCase(), - _tokenId - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _tokenId, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.safeTransferFrom1.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _tokenId), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -621,25 +589,27 @@ export class DummyERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const txHashPromise = self.safeTransferFrom1.sendTransactionAsync(_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as DummyERC721TokenContract; + const txHashPromise = self.safeTransferFrom1.sendTransactionAsync( + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -647,28 +617,29 @@ export class DummyERC721TokenContract extends BaseContract { _tokenId: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -676,8 +647,7 @@ export class DummyERC721TokenContract extends BaseContract { _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); @@ -689,11 +659,12 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - ]); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -702,30 +673,28 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _tokenId: BigNumber, - ): string { + getABIEncodedTransactionData(_from: string, _to: string, _tokenId: BigNumber): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - ]); + const self = (this as any) as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + ]); return abiEncodedTransactionData; }, }; @@ -734,8 +703,7 @@ export class DummyERC721TokenContract extends BaseContract { _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('_tokenId', _tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -745,9 +713,8 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId - ]); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -756,24 +723,22 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('ownerOf(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _tokenId: BigNumber, - ): string { + getABIEncodedTransactionData(_tokenId: BigNumber): string { assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId - ]); + const self = (this as any) as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId]); return abiEncodedTransactionData; }, }; @@ -782,8 +747,7 @@ export class DummyERC721TokenContract extends BaseContract { _owner: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -793,9 +757,8 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() - ]); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -804,33 +767,27 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _owner: string, - ): string { + getABIEncodedTransactionData(_owner: string): string { assert.isString('_owner', _owner); - const self = this as any as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() - ]); + const self = (this as any) as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); return abiEncodedTransactionData; }, }; public owner = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -839,7 +796,7 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC721TokenContract; + const self = (this as any) as DummyERC721TokenContract; const encodedData = self._strictEncodeArguments('owner()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -849,30 +806,26 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as DummyERC721TokenContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as DummyERC721TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); return abiEncodedTransactionData; }, }; public symbol = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -881,7 +834,7 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC721TokenContract; + const self = (this as any) as DummyERC721TokenContract; const encodedData = self._strictEncodeArguments('symbol()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -891,20 +844,20 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('symbol()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as DummyERC721TokenContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as DummyERC721TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('symbol()', []); return abiEncodedTransactionData; }, @@ -913,33 +866,27 @@ export class DummyERC721TokenContract extends BaseContract { async sendTransactionAsync( _owner: string, _tokenId: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_owner', _owner); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner.toLowerCase(), - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.burn.estimateGasAsync.bind( - self, - _owner.toLowerCase(), - _tokenId - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isString('_owner', _owner); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner.toLowerCase(), _tokenId]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.burn.estimateGasAsync.bind(self, _owner.toLowerCase(), _tokenId), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _owner: string, @@ -948,57 +895,52 @@ export class DummyERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_owner', _owner); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const txHashPromise = self.burn.sendTransactionAsync(_owner.toLowerCase(), - _tokenId - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_owner', _owner); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as DummyERC721TokenContract; + const txHashPromise = self.burn.sendTransactionAsync(_owner.toLowerCase(), _tokenId, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _owner: string, _tokenId: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_owner', _owner); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner.toLowerCase(), - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_owner', _owner); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner.toLowerCase(), _tokenId]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _owner: string, _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.isBigNumber('_tokenId', _tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -1009,10 +951,8 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner.toLowerCase(), - _tokenId - ]); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner.toLowerCase(), _tokenId]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1021,27 +961,26 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('burn(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _owner: string, - _tokenId: BigNumber, - ): string { + getABIEncodedTransactionData(_owner: string, _tokenId: BigNumber): string { assert.isString('_owner', _owner); assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('burn(address,uint256)', [_owner.toLowerCase(), - _tokenId - ]); + const self = (this as any) as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('burn(address,uint256)', [ + _owner.toLowerCase(), + _tokenId, + ]); return abiEncodedTransactionData; }, }; @@ -1049,33 +988,30 @@ export class DummyERC721TokenContract extends BaseContract { async sendTransactionAsync( _operator: string, _approved: boolean, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_operator', _operator); - assert.isBoolean('_approved', _approved); - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(), - _approved - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.setApprovalForAll.estimateGasAsync.bind( - self, + assert.isString('_operator', _operator); + assert.isBoolean('_approved', _approved); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ _operator.toLowerCase(), - _approved - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _approved, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.setApprovalForAll.estimateGasAsync.bind(self, _operator.toLowerCase(), _approved), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _operator: string, @@ -1084,57 +1020,59 @@ export class DummyERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_operator', _operator); - assert.isBoolean('_approved', _approved); - const self = this as any as DummyERC721TokenContract; - const txHashPromise = self.setApprovalForAll.sendTransactionAsync(_operator.toLowerCase(), - _approved - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_operator', _operator); + assert.isBoolean('_approved', _approved); + const self = (this as any) as DummyERC721TokenContract; + const txHashPromise = self.setApprovalForAll.sendTransactionAsync( + _operator.toLowerCase(), + _approved, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _operator: string, _approved: boolean, txData?: Partial | undefined, ): Promise { - assert.isString('_operator', _operator); - assert.isBoolean('_approved', _approved); - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(), - _approved - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_operator', _operator); + assert.isBoolean('_approved', _approved); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ + _operator.toLowerCase(), + _approved, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _operator: string, _approved: boolean, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_operator', _operator); assert.isBoolean('_approved', _approved); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -1145,10 +1083,11 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(), - _approved - ]); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ + _operator.toLowerCase(), + _approved, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1157,27 +1096,26 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _operator: string, - _approved: boolean, - ): string { + getABIEncodedTransactionData(_operator: string, _approved: boolean): string { assert.isString('_operator', _operator); assert.isBoolean('_approved', _approved); - const self = this as any as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(), - _approved - ]); + const self = (this as any) as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ + _operator.toLowerCase(), + _approved, + ]); return abiEncodedTransactionData; }, }; @@ -1187,39 +1125,40 @@ export class DummyERC721TokenContract extends BaseContract { _to: string, _tokenId: BigNumber, _data: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - assert.isString('_data', _data); - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.safeTransferFrom2.estimateGasAsync.bind( - self, + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + assert.isString('_data', _data); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [ _from.toLowerCase(), _to.toLowerCase(), _tokenId, - _data - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _data, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.safeTransferFrom2.estimateGasAsync.bind( + self, + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data, + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -1230,27 +1169,29 @@ export class DummyERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - assert.isString('_data', _data); - const self = this as any as DummyERC721TokenContract; - const txHashPromise = self.safeTransferFrom2.sendTransactionAsync(_from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + assert.isString('_data', _data); + const self = (this as any) as DummyERC721TokenContract; + const txHashPromise = self.safeTransferFrom2.sendTransactionAsync( + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -1259,30 +1200,31 @@ export class DummyERC721TokenContract extends BaseContract { _data: string, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - assert.isString('_data', _data); - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + assert.isString('_data', _data); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -1291,8 +1233,7 @@ export class DummyERC721TokenContract extends BaseContract { _data: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); @@ -1305,12 +1246,13 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data - ]); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1319,33 +1261,28 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _tokenId: BigNumber, - _data: string, - ): string { + getABIEncodedTransactionData(_from: string, _to: string, _tokenId: BigNumber, _data: string): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); assert.isString('_data', _data); - const self = this as any as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data - ]); + const self = (this as any) as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'safeTransferFrom(address,address,uint256,bytes)', + [_from.toLowerCase(), _to.toLowerCase(), _tokenId, _data], + ); return abiEncodedTransactionData; }, }; @@ -1355,8 +1292,7 @@ export class DummyERC721TokenContract extends BaseContract { _operator: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.isString('_operator', _operator); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -1367,10 +1303,11 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('isApprovedForAll(address,address)', [_owner.toLowerCase(), - _operator.toLowerCase() - ]); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('isApprovedForAll(address,address)', [ + _owner.toLowerCase(), + _operator.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1379,57 +1316,49 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isApprovedForAll(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _owner: string, - _operator: string, - ): string { + getABIEncodedTransactionData(_owner: string, _operator: string): string { assert.isString('_owner', _owner); assert.isString('_operator', _operator); - const self = this as any as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('isApprovedForAll(address,address)', [_owner.toLowerCase(), - _operator.toLowerCase() - ]); + const self = (this as any) as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isApprovedForAll(address,address)', [ + _owner.toLowerCase(), + _operator.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('newOwner', newOwner); - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind( - self, - newOwner.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( newOwner: string, @@ -1437,51 +1366,41 @@ export class DummyERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('newOwner', newOwner); - const self = this as any as DummyERC721TokenContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('newOwner', newOwner); + const self = (this as any) as DummyERC721TokenContract; + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - newOwner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('newOwner', newOwner); - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - newOwner: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1491,9 +1410,8 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1502,35 +1420,35 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - newOwner: string, - ): string { + getABIEncodedTransactionData(newOwner: string): string { assert.isString('newOwner', newOwner); - const self = this as any as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); + const self = (this as any) as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ + newOwner.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; -private readonly _subscriptionManager: SubscriptionManager; -public static async deployFrom0xArtifactAsync( + private readonly _subscriptionManager: SubscriptionManager; + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, - _name: string, - _symbol: string, + artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + _name: string, + _symbol: string, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -1543,10 +1461,21 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); - return DummyERC721TokenContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, _name, -_symbol -); + const abiDependencies = _.mapValues( + artifactDependencies, + (artifactDependency: ContractArtifact | SimpleContractArtifact) => { + return artifactDependency.compilerOutput.abi; + }, + ); + return DummyERC721TokenContract.deployAsync( + bytecode, + abi, + provider, + txDefaults, + abiDependencies, + _name, + _symbol, + ); } public static async deployAsync( bytecode: string, @@ -1554,8 +1483,8 @@ _symbol supportedProvider: SupportedProvider, txDefaults: Partial, abiDependencies: { [contractName: string]: ContractAbi }, - _name: string, - _symbol: string, + _name: string, + _symbol: string, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -1565,23 +1494,17 @@ _symbol ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_name, -_symbol -] = BaseContract._formatABIDataItemList( + [_name, _symbol] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [_name, -_symbol -], + [_name, _symbol], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_name, -_symbol -]); + const txData = deployInfo.encode(bytecode, [_name, _symbol]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -1589,23 +1512,24 @@ _symbol logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`DummyERC721Token successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new DummyERC721TokenContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); - contractInstance.constructorArgs = [_name, -_symbol -]; + const contractInstance = new DummyERC721TokenContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + abiDependencies, + ); + contractInstance.constructorArgs = [_name, _symbol]; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'name', outputs: [ { @@ -1617,7 +1541,7 @@ _symbol stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1636,7 +1560,7 @@ _symbol stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1649,13 +1573,12 @@ _symbol }, ], name: 'approve', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1672,13 +1595,12 @@ _symbol }, ], name: 'transferFrom', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1691,13 +1613,12 @@ _symbol }, ], name: 'mint', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1714,13 +1635,12 @@ _symbol }, ], name: 'safeTransferFrom', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1739,7 +1659,7 @@ _symbol stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1758,10 +1678,9 @@ _symbol stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'owner', outputs: [ { @@ -1773,10 +1692,9 @@ _symbol stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'symbol', outputs: [ { @@ -1788,7 +1706,7 @@ _symbol stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1801,13 +1719,12 @@ _symbol }, ], name: 'burn', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1820,13 +1737,12 @@ _symbol }, ], name: 'setApprovalForAll', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1847,13 +1763,12 @@ _symbol }, ], name: 'safeTransferFrom', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1876,7 +1791,7 @@ _symbol stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1885,13 +1800,12 @@ _symbol }, ], name: 'transferOwnership', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { inputs: [ { name: '_name', @@ -1902,13 +1816,12 @@ _symbol type: 'string', }, ], - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'constructor', }, - { + { anonymous: false, inputs: [ { @@ -1928,11 +1841,10 @@ _symbol }, ], name: 'Transfer', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1952,11 +1864,10 @@ _symbol }, ], name: 'Approval', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1976,8 +1887,7 @@ _symbol }, ], name: 'ApprovalForAll', - outputs: [ - ], + outputs: [], type: 'event', }, ] as ContractAbi; @@ -2051,15 +1961,27 @@ _symbol ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { - super('DummyERC721Token', DummyERC721TokenContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { + super( + 'DummyERC721Token', + DummyERC721TokenContract.ABI(), + address, + supportedProvider, + txDefaults, + logDecodeDependencies, + ); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( DummyERC721TokenContract.ABI(), this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 27db00ac50..1eaa590042 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts @@ -1,7 +1,7 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract,PromiseWithTransactionHash } from '@0x/base-contract'; +import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -24,91 +24,144 @@ import * as ethers from 'ethers'; import * as _ from 'lodash'; // tslint:enable:no-unused-variable - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class DutchAuctionContract extends BaseContract { public getAuctionDetails = { async sendTransactionAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - txData?: Partial | undefined, - ): Promise { - - const self = this as any as DutchAuctionContract; - const encodedData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; }, - self._web3Wrapper.getContractDefaults(), - self.getAuctionDetails.estimateGasAsync.bind( - self, - order - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + txData?: Partial | undefined, + ): Promise { + const self = (this as any) as DutchAuctionContract; + const encodedData = self._strictEncodeArguments( + 'getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', + [order], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.getAuctionDetails.estimateGasAsync.bind(self, order), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - - const self = this as any as DutchAuctionContract; - const txHashPromise = self.getAuctionDetails.sendTransactionAsync(order - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + const self = (this as any) as DutchAuctionContract; + const txHashPromise = self.getAuctionDetails.sendTransactionAsync(order, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, txData?: Partial | undefined, ): Promise { - - const self = this as any as DutchAuctionContract; - const encodedData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + const self = (this as any) as DutchAuctionContract; + const encodedData = self._strictEncodeArguments( + 'getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', + [order], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{beginTimeSeconds: BigNumber;endTimeSeconds: BigNumber;beginAmount: BigNumber;endAmount: BigNumber;currentAmount: BigNumber;currentTimeSeconds: BigNumber} - > { - + ): Promise<{ + beginTimeSeconds: BigNumber; + endTimeSeconds: BigNumber; + beginAmount: BigNumber; + endAmount: BigNumber; + currentAmount: BigNumber; + currentTimeSeconds: BigNumber; + }> { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -117,9 +170,11 @@ export class DutchAuctionContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DutchAuctionContract; - const encodedData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order - ]); + const self = (this as any) as DutchAuctionContract; + const encodedData = self._strictEncodeArguments( + 'getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', + [order], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -128,141 +183,266 @@ export class DutchAuctionContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))'); + const abiEncoder = self._lookupAbiEncoder( + 'getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{beginTimeSeconds: BigNumber;endTimeSeconds: BigNumber;beginAmount: BigNumber;endAmount: BigNumber;currentAmount: BigNumber;currentTimeSeconds: BigNumber} - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{ + beginTimeSeconds: BigNumber; + endTimeSeconds: BigNumber; + beginAmount: BigNumber; + endAmount: BigNumber; + currentAmount: BigNumber; + currentTimeSeconds: BigNumber; + }>(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - ): string { - - const self = this as any as DutchAuctionContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order - ]); + getABIEncodedTransactionData(order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }): string { + const self = (this as any) as DutchAuctionContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', + [order], + ); return abiEncodedTransactionData; }, }; public matchOrders = { async sendTransactionAsync( - buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + buyOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, + sellOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, buySignature: string, sellSignature: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - - - assert.isString('buySignature', buySignature); - assert.isString('sellSignature', sellSignature); - const self = this as any as DutchAuctionContract; - const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [buyOrder, - sellOrder, - buySignature, - sellSignature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.matchOrders.estimateGasAsync.bind( - self, - buyOrder, - sellOrder, - buySignature, - sellSignature - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isString('buySignature', buySignature); + assert.isString('sellSignature', sellSignature); + const self = (this as any) as DutchAuctionContract; + const encodedData = self._strictEncodeArguments( + 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', + [buyOrder, sellOrder, buySignature, sellSignature], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.matchOrders.estimateGasAsync.bind(self, buyOrder, sellOrder, buySignature, sellSignature), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + buyOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, + sellOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, buySignature: string, sellSignature: string, txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - - - assert.isString('buySignature', buySignature); - assert.isString('sellSignature', sellSignature); - const self = this as any as DutchAuctionContract; - const txHashPromise = self.matchOrders.sendTransactionAsync(buyOrder, - sellOrder, - buySignature, - sellSignature - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('buySignature', buySignature); + assert.isString('sellSignature', sellSignature); + const self = (this as any) as DutchAuctionContract; + const txHashPromise = self.matchOrders.sendTransactionAsync( + buyOrder, + sellOrder, + buySignature, + sellSignature, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + buyOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, + sellOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, buySignature: string, sellSignature: string, txData?: Partial | undefined, ): Promise { - - - assert.isString('buySignature', buySignature); - assert.isString('sellSignature', sellSignature); - const self = this as any as DutchAuctionContract; - const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [buyOrder, - sellOrder, - buySignature, - sellSignature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('buySignature', buySignature); + assert.isString('sellSignature', sellSignature); + const self = (this as any) as DutchAuctionContract; + const encodedData = self._strictEncodeArguments( + 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', + [buyOrder, sellOrder, buySignature, sellSignature], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + buyOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, + sellOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, buySignature: string, sellSignature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber} - > { - - + ): Promise<{ + left: { + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }; + right: { + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }; + leftMakerAssetSpreadAmount: BigNumber; + }> { assert.isString('buySignature', buySignature); assert.isString('sellSignature', sellSignature); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -273,12 +453,11 @@ export class DutchAuctionContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DutchAuctionContract; - const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [buyOrder, - sellOrder, - buySignature, - sellSignature - ]); + const self = (this as any) as DutchAuctionContract; + const encodedData = self._strictEncodeArguments( + 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', + [buyOrder, sellOrder, buySignature, sellSignature], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -287,42 +466,82 @@ export class DutchAuctionContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(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)'); + const abiEncoder = self._lookupAbiEncoder( + 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber} - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{ + left: { + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }; + right: { + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }; + leftMakerAssetSpreadAmount: BigNumber; + }>(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - buySignature: string, - sellSignature: string, - ): string { - - + buyOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, + sellOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, + buySignature: string, + sellSignature: string, + ): string { assert.isString('buySignature', buySignature); assert.isString('sellSignature', sellSignature); - const self = this as any as DutchAuctionContract; - const abiEncodedTransactionData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [buyOrder, - sellOrder, - buySignature, - sellSignature - ]); + const self = (this as any) as DutchAuctionContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', + [buyOrder, sellOrder, buySignature, sellSignature], + ); return abiEncodedTransactionData; }, }; -public static async deployFrom0xArtifactAsync( + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, - _exchange: string, + artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + _exchange: string, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -335,9 +554,13 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); - return DutchAuctionContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, _exchange -); + const abiDependencies = _.mapValues( + artifactDependencies, + (artifactDependency: ContractArtifact | SimpleContractArtifact) => { + return artifactDependency.compilerOutput.abi; + }, + ); + return DutchAuctionContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, _exchange); } public static async deployAsync( bytecode: string, @@ -345,7 +568,7 @@ public static async deployFrom0xArtifactAsync( supportedProvider: SupportedProvider, txDefaults: Partial, abiDependencies: { [contractName: string]: ContractAbi }, - _exchange: string, + _exchange: string, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -355,20 +578,17 @@ public static async deployFrom0xArtifactAsync( ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_exchange -] = BaseContract._formatABIDataItemList( + [_exchange] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [_exchange -], + [_exchange], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_exchange -]); + const txData = deployInfo.encode(bytecode, [_exchange]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -376,19 +596,22 @@ public static async deployFrom0xArtifactAsync( logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`DutchAuction successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new DutchAuctionContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); - contractInstance.constructorArgs = [_exchange -]; + const contractInstance = new DutchAuctionContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + abiDependencies, + ); + contractInstance.constructorArgs = [_exchange]; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: false, inputs: [ { @@ -443,7 +666,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, ], name: 'getAuctionDetails', @@ -476,14 +699,14 @@ public static async deployFrom0xArtifactAsync( name: 'currentTimeSeconds', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -538,7 +761,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'sellOrder', @@ -592,7 +815,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'buySignature', @@ -629,7 +852,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, { name: 'right', @@ -651,28 +874,27 @@ public static async deployFrom0xArtifactAsync( name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, { name: 'leftMakerAssetSpreadAmount', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { inputs: [ { name: '_exchange', type: 'address', }, ], - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'constructor', @@ -680,11 +902,23 @@ public static async deployFrom0xArtifactAsync( ] as ContractAbi; return abi; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { - super('DutchAuction', DutchAuctionContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { + super( + 'DutchAuction', + DutchAuctionContract.ABI(), + address, + supportedProvider, + txDefaults, + logDecodeDependencies, + ); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 a72fb0c2c6..e3e1d9553a 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts @@ -1,11 +1,14 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, +import { + BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; + SubscriptionManager, + PromiseWithTransactionHash, +} from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -48,38 +51,30 @@ export interface ERC20ProxyAuthorizedAddressRemovedEventArgs extends DecodedLogA caller: string; } - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class ERC20ProxyContract extends BaseContract { public addAuthorizedAddress = { - async sendTransactionAsync( - target: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('target', target); - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.addAuthorizedAddress.estimateGasAsync.bind( - self, - target.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.addAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -87,51 +82,41 @@ export class ERC20ProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = this as any as ERC20ProxyContract; - const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + const self = (this as any) as ERC20ProxyContract; + const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - target: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('target', target); - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - target: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('target', target); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -141,9 +126,8 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() - ]); + const self = (this as any) as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -152,24 +136,24 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - target: string, - ): string { + getABIEncodedTransactionData(target: string): string { assert.isString('target', target); - const self = this as any as ERC20ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() - ]); + const self = (this as any) as ERC20ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [ + target.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; @@ -178,8 +162,7 @@ export class ERC20ProxyContract extends BaseContract { index_0: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -189,9 +172,8 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0 - ]); + const self = (this as any) as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -200,54 +182,45 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: BigNumber, - ): string { + getABIEncodedTransactionData(index_0: BigNumber): string { assert.isBigNumber('index_0', index_0); - const self = this as any as ERC20ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('authorities(uint256)', [index_0 - ]); + const self = (this as any) as ERC20ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('authorities(uint256)', [index_0]); return abiEncodedTransactionData; }, }; public removeAuthorizedAddress = { - async sendTransactionAsync( - target: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('target', target); - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddress.estimateGasAsync.bind( - self, - target.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -255,51 +228,41 @@ export class ERC20ProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = this as any as ERC20ProxyContract; - const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + const self = (this as any) as ERC20ProxyContract; + const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - target: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('target', target); - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - target: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('target', target); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -309,9 +272,8 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() - ]); + const self = (this as any) as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -320,33 +282,29 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - target: string, - ): string { + getABIEncodedTransactionData(target: string): string { assert.isString('target', target); - const self = this as any as ERC20ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() - ]); + const self = (this as any) as ERC20ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [ + target.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public owner = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -355,7 +313,7 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC20ProxyContract; + const self = (this as any) as ERC20ProxyContract; const encodedData = self._strictEncodeArguments('owner()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -365,20 +323,20 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as ERC20ProxyContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as ERC20ProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); return abiEncodedTransactionData; }, @@ -387,33 +345,30 @@ export class ERC20ProxyContract extends BaseContract { async sendTransactionAsync( target: string, index: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), - index - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind( - self, + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ target.toLowerCase(), - index - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + index, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(self, target.toLowerCase(), index), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -422,57 +377,59 @@ export class ERC20ProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = this as any as ERC20ProxyContract; - const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync(target.toLowerCase(), - index - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as ERC20ProxyContract; + const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync( + target.toLowerCase(), + index, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( target: string, index: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), - index - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ + target.toLowerCase(), + index, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( target: string, index: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('target', target); assert.isBigNumber('index', index); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -483,10 +440,11 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), - index - ]); + const self = (this as any) as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ + target.toLowerCase(), + index, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -495,36 +453,31 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - target: string, - index: BigNumber, - ): string { + getABIEncodedTransactionData(target: string, index: BigNumber): string { assert.isString('target', target); assert.isBigNumber('index', index); - const self = this as any as ERC20ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), - index - ]); + const self = (this as any) as ERC20ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'removeAuthorizedAddressAtIndex(address,uint256)', + [target.toLowerCase(), index], + ); return abiEncodedTransactionData; }, }; public getProxyId = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -533,7 +486,7 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC20ProxyContract; + const self = (this as any) as ERC20ProxyContract; const encodedData = self._strictEncodeArguments('getProxyId()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -543,20 +496,20 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getProxyId()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as ERC20ProxyContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as ERC20ProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('getProxyId()', []); return abiEncodedTransactionData; }, @@ -566,8 +519,7 @@ export class ERC20ProxyContract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -577,9 +529,8 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase() - ]); + const self = (this as any) as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -588,33 +539,29 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorized(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: string, - ): string { + getABIEncodedTransactionData(index_0: string): string { assert.isString('index_0', index_0); - const self = this as any as ERC20ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase() - ]); + const self = (this as any) as ERC20ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [ + index_0.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public getAuthorizedAddresses = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -623,7 +570,7 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC20ProxyContract; + const self = (this as any) as ERC20ProxyContract; const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -633,51 +580,44 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as ERC20ProxyContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as ERC20ProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('getAuthorizedAddresses()', []); return abiEncodedTransactionData; }, }; public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('newOwner', newOwner); - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind( - self, - newOwner.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( newOwner: string, @@ -685,51 +625,41 @@ export class ERC20ProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('newOwner', newOwner); - const self = this as any as ERC20ProxyContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('newOwner', newOwner); + const self = (this as any) as ERC20ProxyContract; + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - newOwner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('newOwner', newOwner); - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - newOwner: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -739,9 +669,8 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); + const self = (this as any) as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -750,33 +679,33 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - newOwner: string, - ): string { + getABIEncodedTransactionData(newOwner: string): string { assert.isString('newOwner', newOwner); - const self = this as any as ERC20ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); + const self = (this as any) as ERC20ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ + newOwner.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; -private readonly _subscriptionManager: SubscriptionManager; -public static async deployFrom0xArtifactAsync( + private readonly _subscriptionManager: SubscriptionManager; + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -789,8 +718,13 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); - return ERC20ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, ); + const abiDependencies = _.mapValues( + artifactDependencies, + (artifactDependency: ContractArtifact | SimpleContractArtifact) => { + return artifactDependency.compilerOutput.abi; + }, + ); + return ERC20ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies); } public static async deployAsync( bytecode: string, @@ -807,17 +741,13 @@ public static async deployFrom0xArtifactAsync( ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); + [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -825,18 +755,22 @@ public static async deployFrom0xArtifactAsync( logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`ERC20Proxy successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ERC20ProxyContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); + const contractInstance = new ERC20ProxyContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + abiDependencies, + ); contractInstance.constructorArgs = []; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: false, inputs: [ { @@ -845,13 +779,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'addAuthorizedAddress', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -870,7 +803,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -879,16 +812,14 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'removeAuthorizedAddress', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'owner', outputs: [ { @@ -900,7 +831,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -913,16 +844,14 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'removeAuthorizedAddressAtIndex', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'getProxyId', outputs: [ { @@ -934,7 +863,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'pure', type: 'function', }, - { + { constant: true, inputs: [ { @@ -953,10 +882,9 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'getAuthorizedAddresses', outputs: [ { @@ -968,7 +896,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -977,22 +905,19 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'transferOwnership', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { - inputs: [ - ], - outputs: [ - ], + { + inputs: [], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'fallback', }, - { + { anonymous: false, inputs: [ { @@ -1007,11 +932,10 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'AuthorizedAddressAdded', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1026,8 +950,7 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'AuthorizedAddressRemoved', - outputs: [ - ], + outputs: [], type: 'event', }, ] as ContractAbi; @@ -1101,7 +1024,12 @@ public static async deployFrom0xArtifactAsync( ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { super('ERC20Proxy', ERC20ProxyContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( @@ -1109,7 +1037,7 @@ public static async deployFrom0xArtifactAsync( this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 2985e6d710..851bb18d4d 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts @@ -1,11 +1,14 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, +import { + BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; + SubscriptionManager, + PromiseWithTransactionHash, +} from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -29,9 +32,7 @@ import * as ethers from 'ethers'; import * as _ from 'lodash'; // tslint:enable:no-unused-variable -export type ERC20TokenEventArgs = - | ERC20TokenTransferEventArgs - | ERC20TokenApprovalEventArgs; +export type ERC20TokenEventArgs = ERC20TokenTransferEventArgs | ERC20TokenApprovalEventArgs; export enum ERC20TokenEvents { Transfer = 'Transfer', @@ -50,7 +51,6 @@ export interface ERC20TokenApprovalEventArgs extends DecodedLogArgs { _value: BigNumber; } - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name @@ -59,33 +59,30 @@ export class ERC20TokenContract extends BaseContract { async sendTransactionAsync( _spender: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = this as any as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind( - self, + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = (this as any) as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ _spender.toLowerCase(), - _value - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _value, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.approve.estimateGasAsync.bind(self, _spender.toLowerCase(), _value), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _spender: string, @@ -94,57 +91,55 @@ export class ERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = this as any as ERC20TokenContract; - const txHashPromise = self.approve.sendTransactionAsync(_spender.toLowerCase(), - _value - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = (this as any) as ERC20TokenContract; + const txHashPromise = self.approve.sendTransactionAsync(_spender.toLowerCase(), _value, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _spender: string, _value: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = this as any as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = (this as any) as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + _spender.toLowerCase(), + _value, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _spender: string, _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -155,10 +150,11 @@ export class ERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), - _value - ]); + const self = (this as any) as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + _spender.toLowerCase(), + _value, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -167,36 +163,31 @@ export class ERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _spender: string, - _value: BigNumber, - ): string { + getABIEncodedTransactionData(_spender: string, _value: BigNumber): string { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); - const self = this as any as ERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), - _value - ]); + const self = (this as any) as ERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [ + _spender.toLowerCase(), + _value, + ]); return abiEncodedTransactionData; }, }; public totalSupply = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -205,7 +196,7 @@ export class ERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC20TokenContract; + const self = (this as any) as ERC20TokenContract; const encodedData = self._strictEncodeArguments('totalSupply()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -215,20 +206,20 @@ export class ERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('totalSupply()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as ERC20TokenContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as ERC20TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('totalSupply()', []); return abiEncodedTransactionData; }, @@ -238,36 +229,32 @@ export class ERC20TokenContract extends BaseContract { _from: string, _to: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind( - self, + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ _from.toLowerCase(), _to.toLowerCase(), - _value - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _value, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferFrom.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _value), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -277,25 +264,27 @@ export class ERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as ERC20TokenContract; - const txHashPromise = self.transferFrom.sendTransactionAsync(_from.toLowerCase(), - _to.toLowerCase(), - _value - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as ERC20TokenContract; + const txHashPromise = self.transferFrom.sendTransactionAsync( + _from.toLowerCase(), + _to.toLowerCase(), + _value, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -303,28 +292,29 @@ export class ERC20TokenContract extends BaseContract { _value: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _value, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -332,8 +322,7 @@ export class ERC20TokenContract extends BaseContract { _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_value', _value); @@ -345,11 +334,12 @@ export class ERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _value - ]); + const self = (this as any) as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _value, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -358,30 +348,28 @@ export class ERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _value: BigNumber, - ): string { + getABIEncodedTransactionData(_from: string, _to: string, _value: BigNumber): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_value', _value); - const self = this as any as ERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _value - ]); + const self = (this as any) as ERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _value, + ]); return abiEncodedTransactionData; }, }; @@ -390,8 +378,7 @@ export class ERC20TokenContract extends BaseContract { _owner: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -401,9 +388,8 @@ export class ERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() - ]); + const self = (this as any) as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -412,24 +398,22 @@ export class ERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _owner: string, - ): string { + getABIEncodedTransactionData(_owner: string): string { assert.isString('_owner', _owner); - const self = this as any as ERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() - ]); + const self = (this as any) as ERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); return abiEncodedTransactionData; }, }; @@ -437,33 +421,27 @@ export class ERC20TokenContract extends BaseContract { async sendTransactionAsync( _to: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transfer.estimateGasAsync.bind( - self, - _to.toLowerCase(), - _value - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transfer.estimateGasAsync.bind(self, _to.toLowerCase(), _value), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _to: string, @@ -472,57 +450,48 @@ export class ERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as ERC20TokenContract; - const txHashPromise = self.transfer.sendTransactionAsync(_to.toLowerCase(), - _value - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as ERC20TokenContract; + const txHashPromise = self.transfer.sendTransactionAsync(_to.toLowerCase(), _value, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - _to: string, - _value: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(_to: string, _value: BigNumber, txData?: Partial | undefined): Promise { + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _to: string, _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_to', _to); assert.isBigNumber('_value', _value); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -533,10 +502,8 @@ export class ERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), - _value - ]); + const self = (this as any) as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -545,27 +512,26 @@ export class ERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _to: string, - _value: BigNumber, - ): string { + getABIEncodedTransactionData(_to: string, _value: BigNumber): string { assert.isString('_to', _to); assert.isBigNumber('_value', _value); - const self = this as any as ERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), - _value - ]); + const self = (this as any) as ERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [ + _to.toLowerCase(), + _value, + ]); return abiEncodedTransactionData; }, }; @@ -575,8 +541,7 @@ export class ERC20TokenContract extends BaseContract { _spender: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.isString('_spender', _spender); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -587,10 +552,11 @@ export class ERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('allowance(address,address)', [_owner.toLowerCase(), - _spender.toLowerCase() - ]); + const self = (this as any) as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('allowance(address,address)', [ + _owner.toLowerCase(), + _spender.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -599,36 +565,35 @@ export class ERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _owner: string, - _spender: string, - ): string { + getABIEncodedTransactionData(_owner: string, _spender: string): string { assert.isString('_owner', _owner); assert.isString('_spender', _spender); - const self = this as any as ERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [_owner.toLowerCase(), - _spender.toLowerCase() - ]); + const self = (this as any) as ERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [ + _owner.toLowerCase(), + _spender.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; -private readonly _subscriptionManager: SubscriptionManager; -public static async deployFrom0xArtifactAsync( + private readonly _subscriptionManager: SubscriptionManager; + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -641,8 +606,13 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); - return ERC20TokenContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, ); + const abiDependencies = _.mapValues( + artifactDependencies, + (artifactDependency: ContractArtifact | SimpleContractArtifact) => { + return artifactDependency.compilerOutput.abi; + }, + ); + return ERC20TokenContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies); } public static async deployAsync( bytecode: string, @@ -659,17 +629,13 @@ public static async deployFrom0xArtifactAsync( ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); + [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -677,18 +643,22 @@ public static async deployFrom0xArtifactAsync( logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`ERC20Token successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ERC20TokenContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); + const contractInstance = new ERC20TokenContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + abiDependencies, + ); contractInstance.constructorArgs = []; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: false, inputs: [ { @@ -711,10 +681,9 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'totalSupply', outputs: [ { @@ -726,7 +695,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -753,7 +722,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -772,7 +741,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -795,7 +764,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -818,7 +787,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { anonymous: false, inputs: [ { @@ -838,11 +807,10 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'Transfer', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -862,8 +830,7 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'Approval', - outputs: [ - ], + outputs: [], type: 'event', }, ] as ContractAbi; @@ -937,7 +904,12 @@ public static async deployFrom0xArtifactAsync( ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { super('ERC20Token', ERC20TokenContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( @@ -945,7 +917,7 @@ public static async deployFrom0xArtifactAsync( this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 ffeb122490..4a5dd7c166 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts @@ -1,11 +1,14 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, +import { + BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; + SubscriptionManager, + PromiseWithTransactionHash, +} from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -48,38 +51,30 @@ export interface ERC721ProxyAuthorizedAddressRemovedEventArgs extends DecodedLog caller: string; } - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class ERC721ProxyContract extends BaseContract { public addAuthorizedAddress = { - async sendTransactionAsync( - target: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('target', target); - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.addAuthorizedAddress.estimateGasAsync.bind( - self, - target.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.addAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -87,51 +82,41 @@ export class ERC721ProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = this as any as ERC721ProxyContract; - const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + const self = (this as any) as ERC721ProxyContract; + const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - target: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('target', target); - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - target: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('target', target); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -141,9 +126,8 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() - ]); + const self = (this as any) as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -152,24 +136,24 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - target: string, - ): string { + getABIEncodedTransactionData(target: string): string { assert.isString('target', target); - const self = this as any as ERC721ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() - ]); + const self = (this as any) as ERC721ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [ + target.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; @@ -178,8 +162,7 @@ export class ERC721ProxyContract extends BaseContract { index_0: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -189,9 +172,8 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0 - ]); + const self = (this as any) as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -200,54 +182,45 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: BigNumber, - ): string { + getABIEncodedTransactionData(index_0: BigNumber): string { assert.isBigNumber('index_0', index_0); - const self = this as any as ERC721ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('authorities(uint256)', [index_0 - ]); + const self = (this as any) as ERC721ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('authorities(uint256)', [index_0]); return abiEncodedTransactionData; }, }; public removeAuthorizedAddress = { - async sendTransactionAsync( - target: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('target', target); - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddress.estimateGasAsync.bind( - self, - target.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -255,51 +228,41 @@ export class ERC721ProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = this as any as ERC721ProxyContract; - const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + const self = (this as any) as ERC721ProxyContract; + const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - target: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('target', target); - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - target: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('target', target); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -309,9 +272,8 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() - ]); + const self = (this as any) as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -320,33 +282,29 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - target: string, - ): string { + getABIEncodedTransactionData(target: string): string { assert.isString('target', target); - const self = this as any as ERC721ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() - ]); + const self = (this as any) as ERC721ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [ + target.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public owner = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -355,7 +313,7 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721ProxyContract; + const self = (this as any) as ERC721ProxyContract; const encodedData = self._strictEncodeArguments('owner()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -365,20 +323,20 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as ERC721ProxyContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as ERC721ProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); return abiEncodedTransactionData; }, @@ -387,33 +345,30 @@ export class ERC721ProxyContract extends BaseContract { async sendTransactionAsync( target: string, index: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), - index - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind( - self, + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ target.toLowerCase(), - index - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + index, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(self, target.toLowerCase(), index), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -422,57 +377,59 @@ export class ERC721ProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = this as any as ERC721ProxyContract; - const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync(target.toLowerCase(), - index - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as ERC721ProxyContract; + const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync( + target.toLowerCase(), + index, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( target: string, index: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), - index - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ + target.toLowerCase(), + index, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( target: string, index: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('target', target); assert.isBigNumber('index', index); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -483,10 +440,11 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), - index - ]); + const self = (this as any) as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ + target.toLowerCase(), + index, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -495,36 +453,31 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - target: string, - index: BigNumber, - ): string { + getABIEncodedTransactionData(target: string, index: BigNumber): string { assert.isString('target', target); assert.isBigNumber('index', index); - const self = this as any as ERC721ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), - index - ]); + const self = (this as any) as ERC721ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'removeAuthorizedAddressAtIndex(address,uint256)', + [target.toLowerCase(), index], + ); return abiEncodedTransactionData; }, }; public getProxyId = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -533,7 +486,7 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721ProxyContract; + const self = (this as any) as ERC721ProxyContract; const encodedData = self._strictEncodeArguments('getProxyId()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -543,20 +496,20 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getProxyId()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as ERC721ProxyContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as ERC721ProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('getProxyId()', []); return abiEncodedTransactionData; }, @@ -566,8 +519,7 @@ export class ERC721ProxyContract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -577,9 +529,8 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase() - ]); + const self = (this as any) as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -588,33 +539,29 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorized(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: string, - ): string { + getABIEncodedTransactionData(index_0: string): string { assert.isString('index_0', index_0); - const self = this as any as ERC721ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase() - ]); + const self = (this as any) as ERC721ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [ + index_0.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public getAuthorizedAddresses = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -623,7 +570,7 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721ProxyContract; + const self = (this as any) as ERC721ProxyContract; const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -633,51 +580,44 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as ERC721ProxyContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as ERC721ProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('getAuthorizedAddresses()', []); return abiEncodedTransactionData; }, }; public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('newOwner', newOwner); - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind( - self, - newOwner.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( newOwner: string, @@ -685,51 +625,41 @@ export class ERC721ProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('newOwner', newOwner); - const self = this as any as ERC721ProxyContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('newOwner', newOwner); + const self = (this as any) as ERC721ProxyContract; + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - newOwner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('newOwner', newOwner); - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - newOwner: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -739,9 +669,8 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); + const self = (this as any) as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -750,33 +679,33 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - newOwner: string, - ): string { + getABIEncodedTransactionData(newOwner: string): string { assert.isString('newOwner', newOwner); - const self = this as any as ERC721ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); + const self = (this as any) as ERC721ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ + newOwner.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; -private readonly _subscriptionManager: SubscriptionManager; -public static async deployFrom0xArtifactAsync( + private readonly _subscriptionManager: SubscriptionManager; + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -789,8 +718,13 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); - return ERC721ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, ); + const abiDependencies = _.mapValues( + artifactDependencies, + (artifactDependency: ContractArtifact | SimpleContractArtifact) => { + return artifactDependency.compilerOutput.abi; + }, + ); + return ERC721ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies); } public static async deployAsync( bytecode: string, @@ -807,17 +741,13 @@ public static async deployFrom0xArtifactAsync( ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); + [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -825,18 +755,22 @@ public static async deployFrom0xArtifactAsync( logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`ERC721Proxy successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ERC721ProxyContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); + const contractInstance = new ERC721ProxyContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + abiDependencies, + ); contractInstance.constructorArgs = []; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: false, inputs: [ { @@ -845,13 +779,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'addAuthorizedAddress', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -870,7 +803,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -879,16 +812,14 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'removeAuthorizedAddress', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'owner', outputs: [ { @@ -900,7 +831,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -913,16 +844,14 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'removeAuthorizedAddressAtIndex', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'getProxyId', outputs: [ { @@ -934,7 +863,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'pure', type: 'function', }, - { + { constant: true, inputs: [ { @@ -953,10 +882,9 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'getAuthorizedAddresses', outputs: [ { @@ -968,7 +896,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -977,22 +905,19 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'transferOwnership', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { - inputs: [ - ], - outputs: [ - ], + { + inputs: [], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'fallback', }, - { + { anonymous: false, inputs: [ { @@ -1007,11 +932,10 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'AuthorizedAddressAdded', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1026,8 +950,7 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'AuthorizedAddressRemoved', - outputs: [ - ], + outputs: [], type: 'event', }, ] as ContractAbi; @@ -1101,7 +1024,12 @@ public static async deployFrom0xArtifactAsync( ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { super('ERC721Proxy', ERC721ProxyContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( @@ -1109,7 +1037,7 @@ public static async deployFrom0xArtifactAsync( this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 c4b4d2a8c7..081cfcad87 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts @@ -1,11 +1,14 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, +import { + BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; + SubscriptionManager, + PromiseWithTransactionHash, +} from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -58,7 +61,6 @@ export interface ERC721TokenApprovalForAllEventArgs extends DecodedLogArgs { _approved: boolean; } - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name @@ -68,8 +70,7 @@ export class ERC721TokenContract extends BaseContract { _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('_tokenId', _tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -79,9 +80,8 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId - ]); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -90,24 +90,22 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getApproved(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _tokenId: BigNumber, - ): string { + getABIEncodedTransactionData(_tokenId: BigNumber): string { assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId - ]); + const self = (this as any) as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId]); return abiEncodedTransactionData; }, }; @@ -115,33 +113,30 @@ export class ERC721TokenContract extends BaseContract { async sendTransactionAsync( _approved: string, _tokenId: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_approved', _approved); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(), - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind( - self, + assert.isString('_approved', _approved); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ _approved.toLowerCase(), - _tokenId - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _tokenId, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.approve.estimateGasAsync.bind(self, _approved.toLowerCase(), _tokenId), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _approved: string, @@ -150,57 +145,55 @@ export class ERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_approved', _approved); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as ERC721TokenContract; - const txHashPromise = self.approve.sendTransactionAsync(_approved.toLowerCase(), - _tokenId - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_approved', _approved); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as ERC721TokenContract; + const txHashPromise = self.approve.sendTransactionAsync(_approved.toLowerCase(), _tokenId, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _approved: string, _tokenId: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_approved', _approved); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(), - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_approved', _approved); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + _approved.toLowerCase(), + _tokenId, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _approved: string, _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_approved', _approved); assert.isBigNumber('_tokenId', _tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -211,10 +204,11 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(), - _tokenId - ]); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + _approved.toLowerCase(), + _tokenId, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -223,27 +217,26 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _approved: string, - _tokenId: BigNumber, - ): string { + getABIEncodedTransactionData(_approved: string, _tokenId: BigNumber): string { assert.isString('_approved', _approved); assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(), - _tokenId - ]); + const self = (this as any) as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [ + _approved.toLowerCase(), + _tokenId, + ]); return abiEncodedTransactionData; }, }; @@ -252,36 +245,32 @@ export class ERC721TokenContract extends BaseContract { _from: string, _to: string, _tokenId: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind( - self, + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ _from.toLowerCase(), _to.toLowerCase(), - _tokenId - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _tokenId, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferFrom.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _tokenId), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -291,25 +280,27 @@ export class ERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as ERC721TokenContract; - const txHashPromise = self.transferFrom.sendTransactionAsync(_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as ERC721TokenContract; + const txHashPromise = self.transferFrom.sendTransactionAsync( + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -317,28 +308,29 @@ export class ERC721TokenContract extends BaseContract { _tokenId: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -346,8 +338,7 @@ export class ERC721TokenContract extends BaseContract { _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); @@ -359,11 +350,12 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - ]); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -372,30 +364,28 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _tokenId: BigNumber, - ): string { + getABIEncodedTransactionData(_from: string, _to: string, _tokenId: BigNumber): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - ]); + const self = (this as any) as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + ]); return abiEncodedTransactionData; }, }; @@ -404,36 +394,32 @@ export class ERC721TokenContract extends BaseContract { _from: string, _to: string, _tokenId: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.safeTransferFrom1.estimateGasAsync.bind( - self, + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ _from.toLowerCase(), _to.toLowerCase(), - _tokenId - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _tokenId, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.safeTransferFrom1.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _tokenId), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -443,25 +429,27 @@ export class ERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as ERC721TokenContract; - const txHashPromise = self.safeTransferFrom1.sendTransactionAsync(_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as ERC721TokenContract; + const txHashPromise = self.safeTransferFrom1.sendTransactionAsync( + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -469,28 +457,29 @@ export class ERC721TokenContract extends BaseContract { _tokenId: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -498,8 +487,7 @@ export class ERC721TokenContract extends BaseContract { _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); @@ -511,11 +499,12 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - ]); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -524,30 +513,28 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _tokenId: BigNumber, - ): string { + getABIEncodedTransactionData(_from: string, _to: string, _tokenId: BigNumber): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - ]); + const self = (this as any) as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + ]); return abiEncodedTransactionData; }, }; @@ -556,8 +543,7 @@ export class ERC721TokenContract extends BaseContract { _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('_tokenId', _tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -567,9 +553,8 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId - ]); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -578,24 +563,22 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('ownerOf(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _tokenId: BigNumber, - ): string { + getABIEncodedTransactionData(_tokenId: BigNumber): string { assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId - ]); + const self = (this as any) as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId]); return abiEncodedTransactionData; }, }; @@ -604,8 +587,7 @@ export class ERC721TokenContract extends BaseContract { _owner: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -615,9 +597,8 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() - ]); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -626,24 +607,22 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _owner: string, - ): string { + getABIEncodedTransactionData(_owner: string): string { assert.isString('_owner', _owner); - const self = this as any as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() - ]); + const self = (this as any) as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); return abiEncodedTransactionData; }, }; @@ -651,33 +630,30 @@ export class ERC721TokenContract extends BaseContract { async sendTransactionAsync( _operator: string, _approved: boolean, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_operator', _operator); - assert.isBoolean('_approved', _approved); - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(), - _approved - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.setApprovalForAll.estimateGasAsync.bind( - self, + assert.isString('_operator', _operator); + assert.isBoolean('_approved', _approved); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ _operator.toLowerCase(), - _approved - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _approved, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.setApprovalForAll.estimateGasAsync.bind(self, _operator.toLowerCase(), _approved), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _operator: string, @@ -686,57 +662,59 @@ export class ERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_operator', _operator); - assert.isBoolean('_approved', _approved); - const self = this as any as ERC721TokenContract; - const txHashPromise = self.setApprovalForAll.sendTransactionAsync(_operator.toLowerCase(), - _approved - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_operator', _operator); + assert.isBoolean('_approved', _approved); + const self = (this as any) as ERC721TokenContract; + const txHashPromise = self.setApprovalForAll.sendTransactionAsync( + _operator.toLowerCase(), + _approved, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _operator: string, _approved: boolean, txData?: Partial | undefined, ): Promise { - assert.isString('_operator', _operator); - assert.isBoolean('_approved', _approved); - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(), - _approved - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_operator', _operator); + assert.isBoolean('_approved', _approved); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ + _operator.toLowerCase(), + _approved, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _operator: string, _approved: boolean, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_operator', _operator); assert.isBoolean('_approved', _approved); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -747,10 +725,11 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(), - _approved - ]); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ + _operator.toLowerCase(), + _approved, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -759,27 +738,26 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _operator: string, - _approved: boolean, - ): string { + getABIEncodedTransactionData(_operator: string, _approved: boolean): string { assert.isString('_operator', _operator); assert.isBoolean('_approved', _approved); - const self = this as any as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(), - _approved - ]); + const self = (this as any) as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ + _operator.toLowerCase(), + _approved, + ]); return abiEncodedTransactionData; }, }; @@ -789,39 +767,40 @@ export class ERC721TokenContract extends BaseContract { _to: string, _tokenId: BigNumber, _data: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - assert.isString('_data', _data); - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.safeTransferFrom2.estimateGasAsync.bind( - self, + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + assert.isString('_data', _data); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [ _from.toLowerCase(), _to.toLowerCase(), _tokenId, - _data - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _data, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.safeTransferFrom2.estimateGasAsync.bind( + self, + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data, + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -832,27 +811,29 @@ export class ERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - assert.isString('_data', _data); - const self = this as any as ERC721TokenContract; - const txHashPromise = self.safeTransferFrom2.sendTransactionAsync(_from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + assert.isString('_data', _data); + const self = (this as any) as ERC721TokenContract; + const txHashPromise = self.safeTransferFrom2.sendTransactionAsync( + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -861,30 +842,31 @@ export class ERC721TokenContract extends BaseContract { _data: string, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - assert.isString('_data', _data); - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + assert.isString('_data', _data); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -893,8 +875,7 @@ export class ERC721TokenContract extends BaseContract { _data: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); @@ -907,12 +888,13 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data - ]); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -921,33 +903,28 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _tokenId: BigNumber, - _data: string, - ): string { + getABIEncodedTransactionData(_from: string, _to: string, _tokenId: BigNumber, _data: string): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); assert.isString('_data', _data); - const self = this as any as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data - ]); + const self = (this as any) as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'safeTransferFrom(address,address,uint256,bytes)', + [_from.toLowerCase(), _to.toLowerCase(), _tokenId, _data], + ); return abiEncodedTransactionData; }, }; @@ -957,8 +934,7 @@ export class ERC721TokenContract extends BaseContract { _operator: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.isString('_operator', _operator); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -969,10 +945,11 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('isApprovedForAll(address,address)', [_owner.toLowerCase(), - _operator.toLowerCase() - ]); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('isApprovedForAll(address,address)', [ + _owner.toLowerCase(), + _operator.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -981,36 +958,35 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isApprovedForAll(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _owner: string, - _operator: string, - ): string { + getABIEncodedTransactionData(_owner: string, _operator: string): string { assert.isString('_owner', _owner); assert.isString('_operator', _operator); - const self = this as any as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('isApprovedForAll(address,address)', [_owner.toLowerCase(), - _operator.toLowerCase() - ]); + const self = (this as any) as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isApprovedForAll(address,address)', [ + _owner.toLowerCase(), + _operator.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; -private readonly _subscriptionManager: SubscriptionManager; -public static async deployFrom0xArtifactAsync( + private readonly _subscriptionManager: SubscriptionManager; + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -1023,8 +999,13 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); - return ERC721TokenContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, ); + const abiDependencies = _.mapValues( + artifactDependencies, + (artifactDependency: ContractArtifact | SimpleContractArtifact) => { + return artifactDependency.compilerOutput.abi; + }, + ); + return ERC721TokenContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies); } public static async deployAsync( bytecode: string, @@ -1041,17 +1022,13 @@ public static async deployFrom0xArtifactAsync( ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); + [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -1059,18 +1036,22 @@ public static async deployFrom0xArtifactAsync( logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`ERC721Token successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ERC721TokenContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); + const contractInstance = new ERC721TokenContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + abiDependencies, + ); contractInstance.constructorArgs = []; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -1089,7 +1070,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1102,13 +1083,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'approve', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1125,13 +1105,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'transferFrom', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1148,13 +1127,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'safeTransferFrom', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1173,7 +1151,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1192,7 +1170,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1205,13 +1183,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'setApprovalForAll', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1232,13 +1209,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'safeTransferFrom', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1261,7 +1237,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { anonymous: false, inputs: [ { @@ -1281,11 +1257,10 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'Transfer', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1305,11 +1280,10 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'Approval', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1329,8 +1303,7 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'ApprovalForAll', - outputs: [ - ], + outputs: [], type: 'event', }, ] as ContractAbi; @@ -1404,7 +1377,12 @@ public static async deployFrom0xArtifactAsync( ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { super('ERC721Token', ERC721TokenContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( @@ -1412,7 +1390,7 @@ public static async deployFrom0xArtifactAsync( this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 a6eecd9aad..fd6b09065b 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 @@ -1,7 +1,7 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract,PromiseWithTransactionHash } from '@0x/base-contract'; +import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -24,7 +24,6 @@ import * as ethers from 'ethers'; import * as _ from 'lodash'; // tslint:enable:no-unused-variable - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name @@ -34,8 +33,7 @@ export class EthBalanceCheckerContract extends BaseContract { addresses: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isArray('addresses', addresses); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -45,9 +43,8 @@ export class EthBalanceCheckerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as EthBalanceCheckerContract; - const encodedData = self._strictEncodeArguments('getEthBalances(address[])', [addresses - ]); + const self = (this as any) as EthBalanceCheckerContract; + const encodedData = self._strictEncodeArguments('getEthBalances(address[])', [addresses]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -56,32 +53,30 @@ export class EthBalanceCheckerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getEthBalances(address[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - addresses: string[], - ): string { + getABIEncodedTransactionData(addresses: string[]): string { assert.isArray('addresses', addresses); - const self = this as any as EthBalanceCheckerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getEthBalances(address[])', [addresses - ]); + const self = (this as any) as EthBalanceCheckerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getEthBalances(address[])', [addresses]); return abiEncodedTransactionData; }, }; -public static async deployFrom0xArtifactAsync( + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -94,8 +89,13 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); - return EthBalanceCheckerContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, ); + const abiDependencies = _.mapValues( + artifactDependencies, + (artifactDependency: ContractArtifact | SimpleContractArtifact) => { + return artifactDependency.compilerOutput.abi; + }, + ); + return EthBalanceCheckerContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies); } public static async deployAsync( bytecode: string, @@ -112,17 +112,13 @@ public static async deployFrom0xArtifactAsync( ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); + [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -130,18 +126,22 @@ public static async deployFrom0xArtifactAsync( logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`EthBalanceChecker successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new EthBalanceCheckerContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); + const contractInstance = new EthBalanceCheckerContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + abiDependencies, + ); contractInstance.constructorArgs = []; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -163,11 +163,23 @@ public static async deployFrom0xArtifactAsync( ] as ContractAbi; return abi; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { - super('EthBalanceChecker', EthBalanceCheckerContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { + super( + 'EthBalanceChecker', + EthBalanceCheckerContract.ABI(), + address, + supportedProvider, + txDefaults, + logDecodeDependencies, + ); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts index 2b78ee980a..ca14974c8f 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts @@ -1,11 +1,14 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, +import { + BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; + SubscriptionManager, + PromiseWithTransactionHash, +} from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -84,7 +87,6 @@ export interface ExchangeAssetProxyRegisteredEventArgs extends DecodedLogArgs { assetProxy: string; } - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name @@ -94,8 +96,7 @@ export class ExchangeContract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -105,9 +106,8 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('filled(bytes32)', [index_0 - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('filled(bytes32)', [index_0]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -116,128 +116,179 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('filled(bytes32)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: string, - ): string { + getABIEncodedTransactionData(index_0: string): string { assert.isString('index_0', index_0); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('filled(bytes32)', [index_0 - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('filled(bytes32)', [index_0]); return abiEncodedTransactionData; }, }; public batchFillOrders = { async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmounts: BigNumber[], signatures: string[], - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, - takerAssetFillAmounts, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.batchFillOrders.estimateGasAsync.bind( - self, - orders, - takerAssetFillAmounts, - signatures - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', + [orders, takerAssetFillAmounts, signatures], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.batchFillOrders.estimateGasAsync.bind(self, orders, takerAssetFillAmounts, signatures), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmounts: BigNumber[], signatures: string[], txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const txHashPromise = self.batchFillOrders.sendTransactionAsync(orders, - takerAssetFillAmounts, - signatures - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.batchFillOrders.sendTransactionAsync( + orders, + takerAssetFillAmounts, + signatures, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmounts: BigNumber[], signatures: string[], txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, - takerAssetFillAmounts, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', + [orders, takerAssetFillAmounts, signatures], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmounts: BigNumber[], signatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { + ): Promise<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }> { assert.isArray('orders', orders); assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); assert.isArray('signatures', signatures); @@ -249,11 +300,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, - takerAssetFillAmounts, - signatures - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', + [orders, takerAssetFillAmounts, signatures], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -262,30 +313,51 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])'); + const abiEncoder = self._lookupAbiEncoder( + 'batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }>(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - ): string { + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, + takerAssetFillAmounts: BigNumber[], + signatures: string[], + ): string { assert.isArray('orders', orders); assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, - takerAssetFillAmounts, - signatures - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', + [orders, takerAssetFillAmounts, signatures], + ); return abiEncodedTransactionData; }, }; @@ -294,8 +366,7 @@ export class ExchangeContract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -305,9 +376,8 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('cancelled(bytes32)', [index_0 - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('cancelled(bytes32)', [index_0]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -316,24 +386,22 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('cancelled(bytes32)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: string, - ): string { + getABIEncodedTransactionData(index_0: string): string { assert.isString('index_0', index_0); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('cancelled(bytes32)', [index_0 - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('cancelled(bytes32)', [index_0]); return abiEncodedTransactionData; }, }; @@ -342,36 +410,32 @@ export class ExchangeContract extends BaseContract { hash: string, signerAddress: string, signature: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('hash', hash); - assert.isString('signerAddress', signerAddress); - assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [hash, - signerAddress.toLowerCase(), - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.preSign.estimateGasAsync.bind( - self, + assert.isString('hash', hash); + assert.isString('signerAddress', signerAddress); + assert.isString('signature', signature); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [ hash, signerAddress.toLowerCase(), - signature - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + signature, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.preSign.estimateGasAsync.bind(self, hash, signerAddress.toLowerCase(), signature), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( hash: string, @@ -381,25 +445,27 @@ export class ExchangeContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('hash', hash); - assert.isString('signerAddress', signerAddress); - assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const txHashPromise = self.preSign.sendTransactionAsync(hash, - signerAddress.toLowerCase(), - signature - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('hash', hash); + assert.isString('signerAddress', signerAddress); + assert.isString('signature', signature); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.preSign.sendTransactionAsync( + hash, + signerAddress.toLowerCase(), + signature, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( hash: string, @@ -407,28 +473,29 @@ export class ExchangeContract extends BaseContract { signature: string, txData?: Partial | undefined, ): Promise { - assert.isString('hash', hash); - assert.isString('signerAddress', signerAddress); - assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [hash, - signerAddress.toLowerCase(), - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('hash', hash); + assert.isString('signerAddress', signerAddress); + assert.isString('signature', signature); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [ + hash, + signerAddress.toLowerCase(), + signature, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( hash: string, @@ -436,8 +503,7 @@ export class ExchangeContract extends BaseContract { signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('hash', hash); assert.isString('signerAddress', signerAddress); assert.isString('signature', signature); @@ -449,11 +515,12 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [hash, - signerAddress.toLowerCase(), - signature - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [ + hash, + signerAddress.toLowerCase(), + signature, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -462,147 +529,248 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('preSign(bytes32,address,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - hash: string, - signerAddress: string, - signature: string, - ): string { + getABIEncodedTransactionData(hash: string, signerAddress: string, signature: string): string { assert.isString('hash', hash); assert.isString('signerAddress', signerAddress); assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [hash, - signerAddress.toLowerCase(), - signature - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [ + hash, + signerAddress.toLowerCase(), + signature, + ]); return abiEncodedTransactionData; }, }; public matchOrders = { async sendTransactionAsync( - leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + leftOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, + rightOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, leftSignature: string, rightSignature: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - - - assert.isString('leftSignature', leftSignature); - assert.isString('rightSignature', rightSignature); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [leftOrder, - rightOrder, - leftSignature, - rightSignature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.matchOrders.estimateGasAsync.bind( - self, - leftOrder, - rightOrder, - leftSignature, - rightSignature - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isString('leftSignature', leftSignature); + assert.isString('rightSignature', rightSignature); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', + [leftOrder, rightOrder, leftSignature, rightSignature], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.matchOrders.estimateGasAsync.bind(self, leftOrder, rightOrder, leftSignature, rightSignature), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + leftOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, + rightOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, leftSignature: string, rightSignature: string, txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - - - assert.isString('leftSignature', leftSignature); - assert.isString('rightSignature', rightSignature); - const self = this as any as ExchangeContract; - const txHashPromise = self.matchOrders.sendTransactionAsync(leftOrder, - rightOrder, - leftSignature, - rightSignature - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('leftSignature', leftSignature); + assert.isString('rightSignature', rightSignature); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.matchOrders.sendTransactionAsync( + leftOrder, + rightOrder, + leftSignature, + rightSignature, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + leftOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, + rightOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, leftSignature: string, rightSignature: string, txData?: Partial | undefined, ): Promise { - - - assert.isString('leftSignature', leftSignature); - assert.isString('rightSignature', rightSignature); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [leftOrder, - rightOrder, - leftSignature, - rightSignature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('leftSignature', leftSignature); + assert.isString('rightSignature', rightSignature); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', + [leftOrder, rightOrder, leftSignature, rightSignature], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + leftOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, + rightOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, leftSignature: string, rightSignature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber} - > { - - + ): Promise<{ + left: { + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }; + right: { + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }; + leftMakerAssetSpreadAmount: BigNumber; + }> { assert.isString('leftSignature', leftSignature); assert.isString('rightSignature', rightSignature); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -613,12 +781,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [leftOrder, - rightOrder, - leftSignature, - rightSignature - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', + [leftOrder, rightOrder, leftSignature, rightSignature], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -627,138 +794,227 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(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)'); + const abiEncoder = self._lookupAbiEncoder( + 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber} - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{ + left: { + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }; + right: { + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }; + leftMakerAssetSpreadAmount: BigNumber; + }>(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - leftSignature: string, - rightSignature: string, - ): string { - - + leftOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, + rightOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, + leftSignature: string, + rightSignature: string, + ): string { assert.isString('leftSignature', leftSignature); assert.isString('rightSignature', rightSignature); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [leftOrder, - rightOrder, - leftSignature, - rightSignature - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', + [leftOrder, rightOrder, leftSignature, rightSignature], + ); return abiEncodedTransactionData; }, }; public fillOrderNoThrow = { async sendTransactionAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, takerAssetFillAmount: BigNumber, signature: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, - takerAssetFillAmount, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.fillOrderNoThrow.estimateGasAsync.bind( - self, - order, - takerAssetFillAmount, - signature - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', + [order, takerAssetFillAmount, signature], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.fillOrderNoThrow.estimateGasAsync.bind(self, order, takerAssetFillAmount, signature), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, takerAssetFillAmount: BigNumber, signature: string, txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const txHashPromise = self.fillOrderNoThrow.sendTransactionAsync(order, - takerAssetFillAmount, - signature - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.fillOrderNoThrow.sendTransactionAsync( + order, + takerAssetFillAmount, + signature, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, takerAssetFillAmount: BigNumber, signature: string, txData?: Partial | undefined, ): Promise { - - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, - takerAssetFillAmount, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', + [order, takerAssetFillAmount, signature], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, takerAssetFillAmount: BigNumber, signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { - + ): Promise<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }> { assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -769,11 +1025,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, - takerAssetFillAmount, - signature - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', + [order, takerAssetFillAmount, signature], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -782,40 +1038,55 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)'); + const abiEncoder = self._lookupAbiEncoder( + 'fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }>(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - signature: string, - ): string { - + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, + takerAssetFillAmount: BigNumber, + signature: string, + ): string { assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, - takerAssetFillAmount, - signature - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', + [order, takerAssetFillAmount, signature], + ); return abiEncodedTransactionData; }, }; public assetProxies = { - async callAsync( - index_0: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(index_0: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -825,9 +1096,8 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0 - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -836,106 +1106,155 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('assetProxies(bytes4)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: string, - ): string { + getABIEncodedTransactionData(index_0: string): string { assert.isString('index_0', index_0); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0 - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0]); return abiEncodedTransactionData; }, }; public batchCancelOrders = { async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - txData?: Partial | undefined, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.batchCancelOrders.estimateGasAsync.bind( - self, - orders - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - awaitTransactionSuccessAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, - ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - const self = this as any as ExchangeContract; - const txHashPromise = self.batchCancelOrders.sendTransactionAsync(orders - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', + [orders], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.batchCancelOrders.estimateGasAsync.bind(self, orders), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + awaitTransactionSuccessAsync( + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, + txData?: Partial, + pollingIntervalMs?: number, + timeoutMs?: number, + ): PromiseWithTransactionHash { + assert.isArray('orders', orders); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.batchCancelOrders.sendTransactionAsync(orders, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', + [orders], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isArray('orders', orders); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -945,9 +1264,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', + [orders], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -956,128 +1277,199 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])'); + const abiEncoder = self._lookupAbiEncoder( + 'batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - ): string { + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, + ): string { assert.isArray('orders', orders); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', + [orders], + ); return abiEncodedTransactionData; }, }; public batchFillOrKillOrders = { async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmounts: BigNumber[], signatures: string[], - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, - takerAssetFillAmounts, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.batchFillOrKillOrders.estimateGasAsync.bind( - self, - orders, - takerAssetFillAmounts, - signatures - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', + [orders, takerAssetFillAmounts, signatures], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.batchFillOrKillOrders.estimateGasAsync.bind(self, orders, takerAssetFillAmounts, signatures), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmounts: BigNumber[], signatures: string[], txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const txHashPromise = self.batchFillOrKillOrders.sendTransactionAsync(orders, - takerAssetFillAmounts, - signatures - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.batchFillOrKillOrders.sendTransactionAsync( + orders, + takerAssetFillAmounts, + signatures, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmounts: BigNumber[], signatures: string[], txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, - takerAssetFillAmounts, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', + [orders, takerAssetFillAmounts, signatures], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmounts: BigNumber[], signatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { + ): Promise<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }> { assert.isArray('orders', orders); assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); assert.isArray('signatures', signatures); @@ -1089,11 +1481,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, - takerAssetFillAmounts, - signatures - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', + [orders, takerAssetFillAmounts, signatures], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1102,60 +1494,74 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])'); + const abiEncoder = self._lookupAbiEncoder( + 'batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }>(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - ): string { + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, + takerAssetFillAmounts: BigNumber[], + signatures: string[], + ): string { assert.isArray('orders', orders); assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, - takerAssetFillAmounts, - signatures - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', + [orders, takerAssetFillAmounts, signatures], + ); return abiEncodedTransactionData; }, }; public cancelOrdersUpTo = { - async sendTransactionAsync( - targetOrderEpoch: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.cancelOrdersUpTo.estimateGasAsync.bind( - self, - targetOrderEpoch - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(targetOrderEpoch: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.cancelOrdersUpTo.estimateGasAsync.bind(self, targetOrderEpoch), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( targetOrderEpoch: BigNumber, @@ -1163,51 +1569,45 @@ export class ExchangeContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); - const self = this as any as ExchangeContract; - const txHashPromise = self.cancelOrdersUpTo.sendTransactionAsync(targetOrderEpoch - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.cancelOrdersUpTo.sendTransactionAsync(targetOrderEpoch, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - targetOrderEpoch: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(targetOrderEpoch: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( targetOrderEpoch: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1217,9 +1617,8 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1228,128 +1627,181 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('cancelOrdersUpTo(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - targetOrderEpoch: BigNumber, - ): string { + getABIEncodedTransactionData(targetOrderEpoch: BigNumber): string { assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [ + targetOrderEpoch, + ]); return abiEncodedTransactionData; }, }; public batchFillOrdersNoThrow = { async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmounts: BigNumber[], signatures: string[], - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, - takerAssetFillAmounts, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.batchFillOrdersNoThrow.estimateGasAsync.bind( - self, - orders, - takerAssetFillAmounts, - signatures - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', + [orders, takerAssetFillAmounts, signatures], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.batchFillOrdersNoThrow.estimateGasAsync.bind(self, orders, takerAssetFillAmounts, signatures), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmounts: BigNumber[], signatures: string[], txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const txHashPromise = self.batchFillOrdersNoThrow.sendTransactionAsync(orders, - takerAssetFillAmounts, - signatures - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.batchFillOrdersNoThrow.sendTransactionAsync( + orders, + takerAssetFillAmounts, + signatures, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmounts: BigNumber[], signatures: string[], txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, - takerAssetFillAmounts, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', + [orders, takerAssetFillAmounts, signatures], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmounts: BigNumber[], signatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { + ): Promise<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }> { assert.isArray('orders', orders); assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); assert.isArray('signatures', signatures); @@ -1361,11 +1813,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, - takerAssetFillAmounts, - signatures - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', + [orders, takerAssetFillAmounts, signatures], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1374,30 +1826,51 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])'); + const abiEncoder = self._lookupAbiEncoder( + 'batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }>(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - ): string { + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, + takerAssetFillAmounts: BigNumber[], + signatures: string[], + ): string { assert.isArray('orders', orders); assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, - takerAssetFillAmounts, - signatures - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', + [orders, takerAssetFillAmounts, signatures], + ); return abiEncodedTransactionData; }, }; @@ -1406,8 +1879,7 @@ export class ExchangeContract extends BaseContract { assetProxyId: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('assetProxyId', assetProxyId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1417,9 +1889,8 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1428,24 +1899,22 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAssetProxy(bytes4)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - assetProxyId: string, - ): string { + getABIEncodedTransactionData(assetProxyId: string): string { assert.isString('assetProxyId', assetProxyId); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId]); return abiEncodedTransactionData; }, }; @@ -1454,8 +1923,7 @@ export class ExchangeContract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1465,9 +1933,8 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('transactions(bytes32)', [index_0 - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('transactions(bytes32)', [index_0]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1476,129 +1943,176 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transactions(bytes32)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: string, - ): string { + getABIEncodedTransactionData(index_0: string): string { assert.isString('index_0', index_0); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transactions(bytes32)', [index_0 - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transactions(bytes32)', [index_0]); return abiEncodedTransactionData; }, }; public fillOrKillOrder = { async sendTransactionAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, takerAssetFillAmount: BigNumber, signature: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, - takerAssetFillAmount, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.fillOrKillOrder.estimateGasAsync.bind( - self, - order, - takerAssetFillAmount, - signature - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', + [order, takerAssetFillAmount, signature], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.fillOrKillOrder.estimateGasAsync.bind(self, order, takerAssetFillAmount, signature), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, takerAssetFillAmount: BigNumber, signature: string, txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const txHashPromise = self.fillOrKillOrder.sendTransactionAsync(order, - takerAssetFillAmount, - signature - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.fillOrKillOrder.sendTransactionAsync( + order, + takerAssetFillAmount, + signature, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, takerAssetFillAmount: BigNumber, signature: string, txData?: Partial | undefined, ): Promise { - - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, - takerAssetFillAmount, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', + [order, takerAssetFillAmount, signature], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, takerAssetFillAmount: BigNumber, signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { - + ): Promise<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }> { assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -1609,11 +2123,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, - takerAssetFillAmount, - signature - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', + [order, takerAssetFillAmount, signature], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1622,30 +2136,50 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)'); + const abiEncoder = self._lookupAbiEncoder( + 'fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }>(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - signature: string, - ): string { - + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, + takerAssetFillAmount: BigNumber, + signature: string, + ): string { assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, - takerAssetFillAmount, - signature - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', + [order, takerAssetFillAmount, signature], + ); return abiEncodedTransactionData; }, }; @@ -1653,33 +2187,34 @@ export class ExchangeContract extends BaseContract { async sendTransactionAsync( validatorAddress: string, approval: boolean, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('validatorAddress', validatorAddress); - assert.isBoolean('approval', approval); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [validatorAddress.toLowerCase(), - approval - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.setSignatureValidatorApproval.estimateGasAsync.bind( - self, + assert.isString('validatorAddress', validatorAddress); + assert.isBoolean('approval', approval); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [ validatorAddress.toLowerCase(), - approval - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + approval, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.setSignatureValidatorApproval.estimateGasAsync.bind( + self, + validatorAddress.toLowerCase(), + approval, + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( validatorAddress: string, @@ -1688,57 +2223,59 @@ export class ExchangeContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('validatorAddress', validatorAddress); - assert.isBoolean('approval', approval); - const self = this as any as ExchangeContract; - const txHashPromise = self.setSignatureValidatorApproval.sendTransactionAsync(validatorAddress.toLowerCase(), - approval - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('validatorAddress', validatorAddress); + assert.isBoolean('approval', approval); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.setSignatureValidatorApproval.sendTransactionAsync( + validatorAddress.toLowerCase(), + approval, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( validatorAddress: string, approval: boolean, txData?: Partial | undefined, ): Promise { - assert.isString('validatorAddress', validatorAddress); - assert.isBoolean('approval', approval); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [validatorAddress.toLowerCase(), - approval - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('validatorAddress', validatorAddress); + assert.isBoolean('approval', approval); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [ + validatorAddress.toLowerCase(), + approval, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( validatorAddress: string, approval: boolean, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('validatorAddress', validatorAddress); assert.isBoolean('approval', approval); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -1749,10 +2286,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [validatorAddress.toLowerCase(), - approval - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [ + validatorAddress.toLowerCase(), + approval, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1761,27 +2299,26 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('setSignatureValidatorApproval(address,bool)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - validatorAddress: string, - approval: boolean, - ): string { + getABIEncodedTransactionData(validatorAddress: string, approval: boolean): string { assert.isString('validatorAddress', validatorAddress); assert.isBoolean('approval', approval); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [validatorAddress.toLowerCase(), - approval - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'setSignatureValidatorApproval(address,bool)', + [validatorAddress.toLowerCase(), approval], + ); return abiEncodedTransactionData; }, }; @@ -1791,8 +2328,7 @@ export class ExchangeContract extends BaseContract { index_1: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.isString('index_1', index_1); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -1803,10 +2339,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('allowedValidators(address,address)', [index_0.toLowerCase(), - index_1.toLowerCase() - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('allowedValidators(address,address)', [ + index_0.toLowerCase(), + index_1.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1815,131 +2352,183 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('allowedValidators(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: string, - index_1: string, - ): string { + getABIEncodedTransactionData(index_0: string, index_1: string): string { assert.isString('index_0', index_0); assert.isString('index_1', index_1); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('allowedValidators(address,address)', [index_0.toLowerCase(), - index_1.toLowerCase() - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('allowedValidators(address,address)', [ + index_0.toLowerCase(), + index_1.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public marketSellOrders = { async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmount: BigNumber, signatures: string[], - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - takerAssetFillAmount, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.marketSellOrders.estimateGasAsync.bind( - self, - orders, - takerAssetFillAmount, - signatures - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isArray('orders', orders); + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + [orders, takerAssetFillAmount, signatures], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.marketSellOrders.estimateGasAsync.bind(self, orders, takerAssetFillAmount, signatures), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const txHashPromise = self.marketSellOrders.sendTransactionAsync(orders, - takerAssetFillAmount, - signatures - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.marketSellOrders.sendTransactionAsync( + orders, + takerAssetFillAmount, + signatures, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - takerAssetFillAmount, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + [orders, takerAssetFillAmount, signatures], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmount: BigNumber, signatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { + ): Promise<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }> { assert.isArray('orders', orders); assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isArray('signatures', signatures); @@ -1951,11 +2540,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - takerAssetFillAmount, - signatures - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + [orders, takerAssetFillAmount, signatures], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1964,40 +2553,73 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); + const abiEncoder = self._lookupAbiEncoder( + 'marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }>(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmount: BigNumber, - signatures: string[], - ): string { + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, + takerAssetFillAmount: BigNumber, + signatures: string[], + ): string { assert.isArray('orders', orders); assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - takerAssetFillAmount, - signatures - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + [orders, takerAssetFillAmount, signatures], + ); return abiEncodedTransactionData; }, }; public getOrdersInfo = { async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise - > { + ): Promise> { assert.isArray('orders', orders); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -2007,9 +2629,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', + [orders], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2018,24 +2642,44 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])'); + const abiEncoder = self._lookupAbiEncoder( + 'getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue< + Array<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }> + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - ): string { + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, + ): string { assert.isArray('orders', orders); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', + [orders], + ); return abiEncodedTransactionData; }, }; @@ -2045,8 +2689,7 @@ export class ExchangeContract extends BaseContract { index_1: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.isString('index_1', index_1); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -2057,10 +2700,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('preSigned(bytes32,address)', [index_0, - index_1.toLowerCase() - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('preSigned(bytes32,address)', [ + index_0, + index_1.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2069,36 +2713,31 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('preSigned(bytes32,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: string, - index_1: string, - ): string { + getABIEncodedTransactionData(index_0: string, index_1: string): string { assert.isString('index_0', index_0); assert.isString('index_1', index_1); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('preSigned(bytes32,address)', [index_0, - index_1.toLowerCase() - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('preSigned(bytes32,address)', [ + index_0, + index_1.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public owner = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -2107,7 +2746,7 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; + const self = (this as any) as ExchangeContract; const encodedData = self._strictEncodeArguments('owner()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -2117,20 +2756,20 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as ExchangeContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as ExchangeContract; const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); return abiEncodedTransactionData; }, @@ -2142,8 +2781,7 @@ export class ExchangeContract extends BaseContract { signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('hash', hash); assert.isString('signerAddress', signerAddress); assert.isString('signature', signature); @@ -2155,11 +2793,12 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [hash, - signerAddress.toLowerCase(), - signature - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [ + hash, + signerAddress.toLowerCase(), + signature, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2168,134 +2807,185 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isValidSignature(bytes32,address,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - hash: string, - signerAddress: string, - signature: string, - ): string { + getABIEncodedTransactionData(hash: string, signerAddress: string, signature: string): string { assert.isString('hash', hash); assert.isString('signerAddress', signerAddress); assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [hash, - signerAddress.toLowerCase(), - signature - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [ + hash, + signerAddress.toLowerCase(), + signature, + ]); return abiEncodedTransactionData; }, }; public marketBuyOrdersNoThrow = { async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, makerAssetFillAmount: BigNumber, signatures: string[], - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - makerAssetFillAmount, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.marketBuyOrdersNoThrow.estimateGasAsync.bind( - self, - orders, - makerAssetFillAmount, - signatures - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + [orders, makerAssetFillAmount, signatures], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.marketBuyOrdersNoThrow.estimateGasAsync.bind(self, orders, makerAssetFillAmount, signatures), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, makerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const txHashPromise = self.marketBuyOrdersNoThrow.sendTransactionAsync(orders, - makerAssetFillAmount, - signatures - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.marketBuyOrdersNoThrow.sendTransactionAsync( + orders, + makerAssetFillAmount, + signatures, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, makerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - makerAssetFillAmount, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + [orders, makerAssetFillAmount, signatures], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, makerAssetFillAmount: BigNumber, signatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { + ): Promise<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }> { assert.isArray('orders', orders); assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); assert.isArray('signatures', signatures); @@ -2307,11 +2997,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - makerAssetFillAmount, - signatures - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + [orders, makerAssetFillAmount, signatures], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2320,135 +3010,200 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); + const abiEncoder = self._lookupAbiEncoder( + 'marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }>(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - makerAssetFillAmount: BigNumber, - signatures: string[], - ): string { + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, + makerAssetFillAmount: BigNumber, + signatures: string[], + ): string { assert.isArray('orders', orders); assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - makerAssetFillAmount, - signatures - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + [orders, makerAssetFillAmount, signatures], + ); return abiEncodedTransactionData; }, }; public fillOrder = { async sendTransactionAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, takerAssetFillAmount: BigNumber, signature: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, - takerAssetFillAmount, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.fillOrder.estimateGasAsync.bind( - self, - order, - takerAssetFillAmount, - signature - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', + [order, takerAssetFillAmount, signature], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.fillOrder.estimateGasAsync.bind(self, order, takerAssetFillAmount, signature), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, takerAssetFillAmount: BigNumber, signature: string, txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const txHashPromise = self.fillOrder.sendTransactionAsync(order, - takerAssetFillAmount, - signature - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.fillOrder.sendTransactionAsync(order, takerAssetFillAmount, signature, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, takerAssetFillAmount: BigNumber, signature: string, txData?: Partial | undefined, ): Promise { - - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, - takerAssetFillAmount, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', + [order, takerAssetFillAmount, signature], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, takerAssetFillAmount: BigNumber, signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { - + ): Promise<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }> { assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -2459,11 +3214,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, - takerAssetFillAmount, - signature - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', + [order, takerAssetFillAmount, signature], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2472,30 +3227,50 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)'); + const abiEncoder = self._lookupAbiEncoder( + 'fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }>(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - signature: string, - ): string { - + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, + takerAssetFillAmount: BigNumber, + signature: string, + ): string { assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, - takerAssetFillAmount, - signature - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', + [order, takerAssetFillAmount, signature], + ); return abiEncodedTransactionData; }, }; @@ -2505,39 +3280,34 @@ export class ExchangeContract extends BaseContract { signerAddress: string, data: string, signature: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isBigNumber('salt', salt); - assert.isString('signerAddress', signerAddress); - assert.isString('data', data); - assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [salt, - signerAddress.toLowerCase(), - data, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.executeTransaction.estimateGasAsync.bind( - self, + assert.isBigNumber('salt', salt); + assert.isString('signerAddress', signerAddress); + assert.isString('data', data); + assert.isString('signature', signature); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [ salt, signerAddress.toLowerCase(), data, - signature - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + signature, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.executeTransaction.estimateGasAsync.bind(self, salt, signerAddress.toLowerCase(), data, signature), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( salt: BigNumber, @@ -2548,27 +3318,29 @@ export class ExchangeContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('salt', salt); - assert.isString('signerAddress', signerAddress); - assert.isString('data', data); - assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const txHashPromise = self.executeTransaction.sendTransactionAsync(salt, - signerAddress.toLowerCase(), - data, - signature - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('salt', salt); + assert.isString('signerAddress', signerAddress); + assert.isString('data', data); + assert.isString('signature', signature); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.executeTransaction.sendTransactionAsync( + salt, + signerAddress.toLowerCase(), + data, + signature, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( salt: BigNumber, @@ -2577,30 +3349,31 @@ export class ExchangeContract extends BaseContract { signature: string, txData?: Partial | undefined, ): Promise { - assert.isBigNumber('salt', salt); - assert.isString('signerAddress', signerAddress); - assert.isString('data', data); - assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [salt, - signerAddress.toLowerCase(), - data, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isBigNumber('salt', salt); + assert.isString('signerAddress', signerAddress); + assert.isString('data', data); + assert.isString('signature', signature); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [ + salt, + signerAddress.toLowerCase(), + data, + signature, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( salt: BigNumber, @@ -2609,8 +3382,7 @@ export class ExchangeContract extends BaseContract { signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('salt', salt); assert.isString('signerAddress', signerAddress); assert.isString('data', data); @@ -2623,12 +3395,13 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [salt, - signerAddress.toLowerCase(), - data, - signature - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [ + salt, + signerAddress.toLowerCase(), + data, + signature, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2637,63 +3410,51 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('executeTransaction(uint256,address,bytes,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - salt: BigNumber, - signerAddress: string, - data: string, - signature: string, - ): string { + getABIEncodedTransactionData(salt: BigNumber, signerAddress: string, data: string, signature: string): string { assert.isBigNumber('salt', salt); assert.isString('signerAddress', signerAddress); assert.isString('data', data); assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [salt, - signerAddress.toLowerCase(), - data, - signature - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'executeTransaction(uint256,address,bytes,bytes)', + [salt, signerAddress.toLowerCase(), data, signature], + ); return abiEncodedTransactionData; }, }; public registerAssetProxy = { - async sendTransactionAsync( - assetProxy: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('assetProxy', assetProxy); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.registerAssetProxy.estimateGasAsync.bind( - self, - assetProxy.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(assetProxy: string, txData?: Partial | undefined): Promise { + assert.isString('assetProxy', assetProxy); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.registerAssetProxy.estimateGasAsync.bind(self, assetProxy.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( assetProxy: string, @@ -2701,51 +3462,45 @@ export class ExchangeContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('assetProxy', assetProxy); - const self = this as any as ExchangeContract; - const txHashPromise = self.registerAssetProxy.sendTransactionAsync(assetProxy.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('assetProxy', assetProxy); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.registerAssetProxy.sendTransactionAsync(assetProxy.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - assetProxy: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('assetProxy', assetProxy); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(assetProxy: string, txData?: Partial | undefined): Promise { + assert.isString('assetProxy', assetProxy); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( assetProxy: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('assetProxy', assetProxy); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -2755,9 +3510,8 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase() - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2766,35 +3520,46 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - assetProxy: string, - ): string { + getABIEncodedTransactionData(assetProxy: string): string { assert.isString('assetProxy', assetProxy); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase() - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address)', [ + assetProxy.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public getOrderInfo = { async callAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber} - > { - + ): Promise<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }> { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -2803,9 +3568,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', + [order], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2814,107 +3581,173 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))'); + const abiEncoder = self._lookupAbiEncoder( + 'getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber} - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{ + orderStatus: number; + orderHash: string; + orderTakerAssetFilledAmount: BigNumber; + }>(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - ): string { - - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order - ]); + getABIEncodedTransactionData(order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }): string { + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', + [order], + ); return abiEncodedTransactionData; }, }; public cancelOrder = { async sendTransactionAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - txData?: Partial | undefined, - ): Promise { - - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; }, - self._web3Wrapper.getContractDefaults(), - self.cancelOrder.estimateGasAsync.bind( - self, - order - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + txData?: Partial | undefined, + ): Promise { + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', + [order], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.cancelOrder.estimateGasAsync.bind(self, order), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - - const self = this as any as ExchangeContract; - const txHashPromise = self.cancelOrder.sendTransactionAsync(order - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.cancelOrder.sendTransactionAsync(order, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, txData?: Partial | undefined, ): Promise { - - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', + [order], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { - + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -2923,9 +3756,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', + [order], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2934,24 +3769,39 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))'); + const abiEncoder = self._lookupAbiEncoder( + 'cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - ): string { - - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order - ]); + getABIEncodedTransactionData(order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }): string { + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', + [order], + ); return abiEncodedTransactionData; }, }; @@ -2961,8 +3811,7 @@ export class ExchangeContract extends BaseContract { index_1: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.isString('index_1', index_1); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -2973,10 +3822,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('orderEpoch(address,address)', [index_0.toLowerCase(), - index_1.toLowerCase() - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('orderEpoch(address,address)', [ + index_0.toLowerCase(), + index_1.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2985,36 +3835,31 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('orderEpoch(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: string, - index_1: string, - ): string { + getABIEncodedTransactionData(index_0: string, index_1: string): string { assert.isString('index_0', index_0); assert.isString('index_1', index_1); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('orderEpoch(address,address)', [index_0.toLowerCase(), - index_1.toLowerCase() - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('orderEpoch(address,address)', [ + index_0.toLowerCase(), + index_1.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public ZRX_ASSET_DATA = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -3023,7 +3868,7 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; + const self = (this as any) as ExchangeContract; const encodedData = self._strictEncodeArguments('ZRX_ASSET_DATA()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -3033,125 +3878,178 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('ZRX_ASSET_DATA()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as ExchangeContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as ExchangeContract; const abiEncodedTransactionData = self._strictEncodeArguments('ZRX_ASSET_DATA()', []); return abiEncodedTransactionData; }, }; public marketSellOrdersNoThrow = { async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmount: BigNumber, signatures: string[], - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - takerAssetFillAmount, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.marketSellOrdersNoThrow.estimateGasAsync.bind( - self, - orders, - takerAssetFillAmount, - signatures - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isArray('orders', orders); + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + [orders, takerAssetFillAmount, signatures], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.marketSellOrdersNoThrow.estimateGasAsync.bind(self, orders, takerAssetFillAmount, signatures), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const txHashPromise = self.marketSellOrdersNoThrow.sendTransactionAsync(orders, - takerAssetFillAmount, - signatures - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.marketSellOrdersNoThrow.sendTransactionAsync( + orders, + takerAssetFillAmount, + signatures, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - takerAssetFillAmount, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + [orders, takerAssetFillAmount, signatures], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmount: BigNumber, signatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { + ): Promise<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }> { assert.isArray('orders', orders); assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isArray('signatures', signatures); @@ -3163,11 +4061,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - takerAssetFillAmount, - signatures - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + [orders, takerAssetFillAmount, signatures], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -3176,39 +4074,56 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); + const abiEncoder = self._lookupAbiEncoder( + 'marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }>(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmount: BigNumber, - signatures: string[], - ): string { + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, + takerAssetFillAmount: BigNumber, + signatures: string[], + ): string { assert.isArray('orders', orders); assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - takerAssetFillAmount, - signatures - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + [orders, takerAssetFillAmount, signatures], + ); return abiEncodedTransactionData; }, }; public EIP712_DOMAIN_HASH = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -3217,7 +4132,7 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; + const self = (this as any) as ExchangeContract; const encodedData = self._strictEncodeArguments('EIP712_DOMAIN_HASH()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -3227,125 +4142,178 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('EIP712_DOMAIN_HASH()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as ExchangeContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as ExchangeContract; const abiEncodedTransactionData = self._strictEncodeArguments('EIP712_DOMAIN_HASH()', []); return abiEncodedTransactionData; }, }; public marketBuyOrders = { async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, makerAssetFillAmount: BigNumber, signatures: string[], - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - makerAssetFillAmount, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.marketBuyOrders.estimateGasAsync.bind( - self, - orders, - makerAssetFillAmount, - signatures - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + [orders, makerAssetFillAmount, signatures], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.marketBuyOrders.estimateGasAsync.bind(self, orders, makerAssetFillAmount, signatures), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, makerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const txHashPromise = self.marketBuyOrders.sendTransactionAsync(orders, - makerAssetFillAmount, - signatures - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.marketBuyOrders.sendTransactionAsync( + orders, + makerAssetFillAmount, + signatures, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, makerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - makerAssetFillAmount, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + [orders, makerAssetFillAmount, signatures], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, makerAssetFillAmount: BigNumber, signatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { + ): Promise<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }> { assert.isArray('orders', orders); assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); assert.isArray('signatures', signatures); @@ -3357,11 +4325,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - makerAssetFillAmount, - signatures - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + [orders, makerAssetFillAmount, signatures], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -3370,39 +4338,56 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); + const abiEncoder = self._lookupAbiEncoder( + 'marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }>(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - makerAssetFillAmount: BigNumber, - signatures: string[], - ): string { + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, + makerAssetFillAmount: BigNumber, + signatures: string[], + ): string { assert.isArray('orders', orders); assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - makerAssetFillAmount, - signatures - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + [orders, makerAssetFillAmount, signatures], + ); return abiEncodedTransactionData; }, }; public currentContextAddress = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -3411,7 +4396,7 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; + const self = (this as any) as ExchangeContract; const encodedData = self._strictEncodeArguments('currentContextAddress()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -3421,51 +4406,44 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('currentContextAddress()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as ExchangeContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as ExchangeContract; const abiEncodedTransactionData = self._strictEncodeArguments('currentContextAddress()', []); return abiEncodedTransactionData; }, }; public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('newOwner', newOwner); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind( - self, - newOwner.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( newOwner: string, @@ -3473,51 +4451,41 @@ export class ExchangeContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('newOwner', newOwner); - const self = this as any as ExchangeContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('newOwner', newOwner); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - newOwner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('newOwner', newOwner); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - newOwner: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -3527,9 +4495,8 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -3538,33 +4505,29 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - newOwner: string, - ): string { + getABIEncodedTransactionData(newOwner: string): string { assert.isString('newOwner', newOwner); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ + newOwner.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public VERSION = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -3573,7 +4536,7 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; + const self = (this as any) as ExchangeContract; const encodedData = self._strictEncodeArguments('VERSION()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -3583,31 +4546,31 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('VERSION()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as ExchangeContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as ExchangeContract; const abiEncodedTransactionData = self._strictEncodeArguments('VERSION()', []); return abiEncodedTransactionData; }, }; -private readonly _subscriptionManager: SubscriptionManager; -public static async deployFrom0xArtifactAsync( + private readonly _subscriptionManager: SubscriptionManager; + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, - _zrxAssetData: string, + artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + _zrxAssetData: string, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -3620,9 +4583,13 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); - return ExchangeContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, _zrxAssetData -); + const abiDependencies = _.mapValues( + artifactDependencies, + (artifactDependency: ContractArtifact | SimpleContractArtifact) => { + return artifactDependency.compilerOutput.abi; + }, + ); + return ExchangeContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, _zrxAssetData); } public static async deployAsync( bytecode: string, @@ -3630,7 +4597,7 @@ public static async deployFrom0xArtifactAsync( supportedProvider: SupportedProvider, txDefaults: Partial, abiDependencies: { [contractName: string]: ContractAbi }, - _zrxAssetData: string, + _zrxAssetData: string, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -3640,20 +4607,17 @@ public static async deployFrom0xArtifactAsync( ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_zrxAssetData -] = BaseContract._formatABIDataItemList( + [_zrxAssetData] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [_zrxAssetData -], + [_zrxAssetData], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_zrxAssetData -]); + const txData = deployInfo.encode(bytecode, [_zrxAssetData]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -3661,19 +4625,22 @@ public static async deployFrom0xArtifactAsync( logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`Exchange successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ExchangeContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); - contractInstance.constructorArgs = [_zrxAssetData -]; + const contractInstance = new ExchangeContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + abiDependencies, + ); + contractInstance.constructorArgs = [_zrxAssetData]; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -3692,7 +4659,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -3747,7 +4714,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'takerAssetFillAmounts', @@ -3780,14 +4747,14 @@ public static async deployFrom0xArtifactAsync( name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -3806,7 +4773,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -3823,13 +4790,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'preSign', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -3884,7 +4850,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'rightOrder', @@ -3938,7 +4904,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'leftSignature', @@ -3975,7 +4941,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, { name: 'right', @@ -3997,20 +4963,20 @@ public static async deployFrom0xArtifactAsync( name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, { name: 'leftMakerAssetSpreadAmount', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -4065,7 +5031,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'takerAssetFillAmount', @@ -4098,14 +5064,14 @@ public static async deployFrom0xArtifactAsync( name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -4124,7 +5090,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -4179,17 +5145,16 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, ], name: 'batchCancelOrders', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -4244,7 +5209,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'takerAssetFillAmounts', @@ -4277,14 +5242,14 @@ public static async deployFrom0xArtifactAsync( name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -4293,13 +5258,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'cancelOrdersUpTo', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -4354,7 +5318,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'takerAssetFillAmounts', @@ -4387,14 +5351,14 @@ public static async deployFrom0xArtifactAsync( name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -4413,7 +5377,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -4432,7 +5396,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -4487,7 +5451,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'takerAssetFillAmount', @@ -4520,14 +5484,14 @@ public static async deployFrom0xArtifactAsync( name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -4540,13 +5504,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'setSignatureValidatorApproval', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -4569,7 +5532,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -4624,7 +5587,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'takerAssetFillAmount', @@ -4657,14 +5620,14 @@ public static async deployFrom0xArtifactAsync( name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -4719,7 +5682,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, ], name: 'getOrdersInfo', @@ -4740,14 +5703,14 @@ public static async deployFrom0xArtifactAsync( name: 'orderTakerAssetFilledAmount', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -4770,10 +5733,9 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'owner', outputs: [ { @@ -4785,7 +5747,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -4812,7 +5774,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -4867,7 +5829,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'makerAssetFillAmount', @@ -4900,14 +5862,14 @@ public static async deployFrom0xArtifactAsync( name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -4962,7 +5924,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'takerAssetFillAmount', @@ -4995,14 +5957,14 @@ public static async deployFrom0xArtifactAsync( name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -5023,13 +5985,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'executeTransaction', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -5038,13 +5999,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'registerAssetProxy', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -5099,7 +6059,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, ], name: 'getOrderInfo', @@ -5120,14 +6080,14 @@ public static async deployFrom0xArtifactAsync( name: 'orderTakerAssetFilledAmount', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -5182,17 +6142,16 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, ], name: 'cancelOrder', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -5215,10 +6174,9 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'ZRX_ASSET_DATA', outputs: [ { @@ -5230,7 +6188,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -5285,7 +6243,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'takerAssetFillAmount', @@ -5318,17 +6276,16 @@ public static async deployFrom0xArtifactAsync( name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'EIP712_DOMAIN_HASH', outputs: [ { @@ -5340,7 +6297,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -5395,7 +6352,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'makerAssetFillAmount', @@ -5428,17 +6385,16 @@ public static async deployFrom0xArtifactAsync( name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'currentContextAddress', outputs: [ { @@ -5450,7 +6406,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -5459,16 +6415,14 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'transferOwnership', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'VERSION', outputs: [ { @@ -5480,20 +6434,19 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { inputs: [ { name: '_zrxAssetData', type: 'bytes', }, ], - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'constructor', }, - { + { anonymous: false, inputs: [ { @@ -5513,11 +6466,10 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'SignatureValidatorApproval', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -5577,11 +6529,10 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'Fill', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -5616,11 +6567,10 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'Cancel', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -5640,11 +6590,10 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'CancelUpTo', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -5659,8 +6608,7 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'AssetProxyRegistered', - outputs: [ - ], + outputs: [], type: 'event', }, ] as ContractAbi; @@ -5734,7 +6682,12 @@ public static async deployFrom0xArtifactAsync( ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { super('Exchange', ExchangeContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( @@ -5742,7 +6695,7 @@ public static async deployFrom0xArtifactAsync( this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts b/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts index 8534657a74..516d23f1c6 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts @@ -1,7 +1,7 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract,PromiseWithTransactionHash } from '@0x/base-contract'; +import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -24,68 +24,123 @@ import * as ethers from 'ethers'; import * as _ from 'lodash'; // tslint:enable:no-unused-variable - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class ForwarderContract extends BaseContract { public marketBuyOrdersWithEth = { async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, makerAssetFillAmount: BigNumber, signatures: string[], - feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + feeOrders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, feeSignatures: string[], feePercentage: BigNumber, feeRecipient: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - assert.isArray('feeOrders', feeOrders); - assert.isArray('feeSignatures', feeSignatures); - assert.isBigNumber('feePercentage', feePercentage); - assert.isString('feeRecipient', feeRecipient); - const self = this as any as ForwarderContract; - const encodedData = self._strictEncodeArguments('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.marketBuyOrdersWithEth.estimateGasAsync.bind( - self, - orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + assert.isArray('feeOrders', feeOrders); + assert.isArray('feeSignatures', feeSignatures); + assert.isBigNumber('feePercentage', feePercentage); + assert.isString('feeRecipient', feeRecipient); + const self = (this as any) as ForwarderContract; + const encodedData = self._strictEncodeArguments( + 'marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', + [ + orders, + makerAssetFillAmount, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase(), + ], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.marketBuyOrdersWithEth.estimateGasAsync.bind( + self, + orders, + makerAssetFillAmount, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase(), + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, makerAssetFillAmount: BigNumber, signatures: string[], - feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + feeOrders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, feeSignatures: string[], feePercentage: BigNumber, feeRecipient: string, @@ -93,86 +148,158 @@ export class ForwarderContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - assert.isArray('feeOrders', feeOrders); - assert.isArray('feeSignatures', feeSignatures); - assert.isBigNumber('feePercentage', feePercentage); - assert.isString('feeRecipient', feeRecipient); - const self = this as any as ForwarderContract; - const txHashPromise = self.marketBuyOrdersWithEth.sendTransactionAsync(orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + assert.isArray('feeOrders', feeOrders); + assert.isArray('feeSignatures', feeSignatures); + assert.isBigNumber('feePercentage', feePercentage); + assert.isString('feeRecipient', feeRecipient); + const self = (this as any) as ForwarderContract; + const txHashPromise = self.marketBuyOrdersWithEth.sendTransactionAsync( + orders, + makerAssetFillAmount, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase(), + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, makerAssetFillAmount: BigNumber, signatures: string[], - feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + feeOrders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, feeSignatures: string[], feePercentage: BigNumber, feeRecipient: string, txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - assert.isArray('feeOrders', feeOrders); - assert.isArray('feeSignatures', feeSignatures); - assert.isBigNumber('feePercentage', feePercentage); - assert.isString('feeRecipient', feeRecipient); - const self = this as any as ForwarderContract; - const encodedData = self._strictEncodeArguments('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + assert.isArray('feeOrders', feeOrders); + assert.isArray('feeSignatures', feeSignatures); + assert.isBigNumber('feePercentage', feePercentage); + assert.isString('feeRecipient', feeRecipient); + const self = (this as any) as ForwarderContract; + const encodedData = self._strictEncodeArguments( + 'marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', + [ + orders, + makerAssetFillAmount, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase(), + ], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, makerAssetFillAmount: BigNumber, signatures: string[], - feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + feeOrders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, feeSignatures: string[], feePercentage: BigNumber, feeRecipient: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}] + ): Promise< + [ + { + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }, + { + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + } + ] > { assert.isArray('orders', orders); assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); @@ -189,15 +316,19 @@ export class ForwarderContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ForwarderContract; - const encodedData = self._strictEncodeArguments('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase() - ]); + const self = (this as any) as ForwarderContract; + const encodedData = self._strictEncodeArguments( + 'marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', + [ + orders, + makerAssetFillAmount, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase(), + ], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -206,26 +337,70 @@ export class ForwarderContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(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)'); + const abiEncoder = self._lookupAbiEncoder( + 'marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}] - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue< + [ + { + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }, + { + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + } + ] + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - makerAssetFillAmount: BigNumber, - signatures: string[], - feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - feeSignatures: string[], - feePercentage: BigNumber, - feeRecipient: string, - ): string { + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, + makerAssetFillAmount: BigNumber, + signatures: string[], + feeOrders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, + feeSignatures: string[], + feePercentage: BigNumber, + feeRecipient: string, + ): string { assert.isArray('orders', orders); assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); assert.isArray('signatures', signatures); @@ -233,15 +408,19 @@ export class ForwarderContract extends BaseContract { assert.isArray('feeSignatures', feeSignatures); assert.isBigNumber('feePercentage', feePercentage); assert.isString('feeRecipient', feeRecipient); - const self = this as any as ForwarderContract; - const abiEncodedTransactionData = self._strictEncodeArguments('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase() - ]); + const self = (this as any) as ForwarderContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', + [ + orders, + makerAssetFillAmount, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase(), + ], + ); return abiEncodedTransactionData; }, }; @@ -249,33 +428,27 @@ export class ForwarderContract extends BaseContract { async sendTransactionAsync( assetData: string, amount: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('assetData', assetData); - assert.isBigNumber('amount', amount); - const self = this as any as ForwarderContract; - const encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData, - amount - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.withdrawAsset.estimateGasAsync.bind( - self, - assetData, - amount - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isString('assetData', assetData); + assert.isBigNumber('amount', amount); + const self = (this as any) as ForwarderContract; + const encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData, amount]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.withdrawAsset.estimateGasAsync.bind(self, assetData, amount), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( assetData: string, @@ -284,57 +457,52 @@ export class ForwarderContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('assetData', assetData); - assert.isBigNumber('amount', amount); - const self = this as any as ForwarderContract; - const txHashPromise = self.withdrawAsset.sendTransactionAsync(assetData, - amount - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('assetData', assetData); + assert.isBigNumber('amount', amount); + const self = (this as any) as ForwarderContract; + const txHashPromise = self.withdrawAsset.sendTransactionAsync(assetData, amount, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( assetData: string, amount: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('assetData', assetData); - assert.isBigNumber('amount', amount); - const self = this as any as ForwarderContract; - const encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData, - amount - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('assetData', assetData); + assert.isBigNumber('amount', amount); + const self = (this as any) as ForwarderContract; + const encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData, amount]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( assetData: string, amount: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('assetData', assetData); assert.isBigNumber('amount', amount); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -345,10 +513,8 @@ export class ForwarderContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ForwarderContract; - const encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData, - amount - ]); + const self = (this as any) as ForwarderContract; + const encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData, amount]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -357,36 +523,31 @@ export class ForwarderContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('withdrawAsset(bytes,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - assetData: string, - amount: BigNumber, - ): string { + getABIEncodedTransactionData(assetData: string, amount: BigNumber): string { assert.isString('assetData', assetData); assert.isBigNumber('amount', amount); - const self = this as any as ForwarderContract; - const abiEncodedTransactionData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData, - amount - ]); + const self = (this as any) as ForwarderContract; + const abiEncodedTransactionData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [ + assetData, + amount, + ]); return abiEncodedTransactionData; }, }; public owner = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -395,7 +556,7 @@ export class ForwarderContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ForwarderContract; + const self = (this as any) as ForwarderContract; const encodedData = self._strictEncodeArguments('owner()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -405,76 +566,125 @@ export class ForwarderContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as ForwarderContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as ForwarderContract; const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); return abiEncodedTransactionData; }, }; public marketSellOrdersWithEth = { async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, signatures: string[], - feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + feeOrders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, feeSignatures: string[], feePercentage: BigNumber, feeRecipient: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isArray('signatures', signatures); - assert.isArray('feeOrders', feeOrders); - assert.isArray('feeSignatures', feeSignatures); - assert.isBigNumber('feePercentage', feePercentage); - assert.isString('feeRecipient', feeRecipient); - const self = this as any as ForwarderContract; - const encodedData = self._strictEncodeArguments('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.marketSellOrdersWithEth.estimateGasAsync.bind( - self, - orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isArray('orders', orders); + assert.isArray('signatures', signatures); + assert.isArray('feeOrders', feeOrders); + assert.isArray('feeSignatures', feeSignatures); + assert.isBigNumber('feePercentage', feePercentage); + assert.isString('feeRecipient', feeRecipient); + const self = (this as any) as ForwarderContract; + const encodedData = self._strictEncodeArguments( + 'marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', + [orders, signatures, feeOrders, feeSignatures, feePercentage, feeRecipient.toLowerCase()], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.marketSellOrdersWithEth.estimateGasAsync.bind( + self, + orders, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase(), + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, signatures: string[], - feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + feeOrders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, feeSignatures: string[], feePercentage: BigNumber, feeRecipient: string, @@ -482,80 +692,145 @@ export class ForwarderContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isArray('signatures', signatures); - assert.isArray('feeOrders', feeOrders); - assert.isArray('feeSignatures', feeSignatures); - assert.isBigNumber('feePercentage', feePercentage); - assert.isString('feeRecipient', feeRecipient); - const self = this as any as ForwarderContract; - const txHashPromise = self.marketSellOrdersWithEth.sendTransactionAsync(orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isArray('signatures', signatures); + assert.isArray('feeOrders', feeOrders); + assert.isArray('feeSignatures', feeSignatures); + assert.isBigNumber('feePercentage', feePercentage); + assert.isString('feeRecipient', feeRecipient); + const self = (this as any) as ForwarderContract; + const txHashPromise = self.marketSellOrdersWithEth.sendTransactionAsync( + orders, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase(), + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, signatures: string[], - feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + feeOrders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, feeSignatures: string[], feePercentage: BigNumber, feeRecipient: string, txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isArray('signatures', signatures); - assert.isArray('feeOrders', feeOrders); - assert.isArray('feeSignatures', feeSignatures); - assert.isBigNumber('feePercentage', feePercentage); - assert.isString('feeRecipient', feeRecipient); - const self = this as any as ForwarderContract; - const encodedData = self._strictEncodeArguments('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isArray('signatures', signatures); + assert.isArray('feeOrders', feeOrders); + assert.isArray('feeSignatures', feeSignatures); + assert.isBigNumber('feePercentage', feePercentage); + assert.isString('feeRecipient', feeRecipient); + const self = (this as any) as ForwarderContract; + const encodedData = self._strictEncodeArguments( + 'marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', + [orders, signatures, feeOrders, feeSignatures, feePercentage, feeRecipient.toLowerCase()], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, signatures: string[], - feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + feeOrders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, feeSignatures: string[], feePercentage: BigNumber, feeRecipient: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}] + ): Promise< + [ + { + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }, + { + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + } + ] > { assert.isArray('orders', orders); assert.isArray('signatures', signatures); @@ -571,14 +846,11 @@ export class ForwarderContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ForwarderContract; - const encodedData = self._strictEncodeArguments('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase() - ]); + const self = (this as any) as ForwarderContract; + const encodedData = self._strictEncodeArguments( + 'marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', + [orders, signatures, feeOrders, feeSignatures, feePercentage, feeRecipient.toLowerCase()], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -587,69 +859,103 @@ export class ForwarderContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(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)'); + const abiEncoder = self._lookupAbiEncoder( + 'marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}] - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue< + [ + { + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }, + { + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + } + ] + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - signatures: string[], - feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - feeSignatures: string[], - feePercentage: BigNumber, - feeRecipient: string, - ): string { + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, + signatures: string[], + feeOrders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, + feeSignatures: string[], + feePercentage: BigNumber, + feeRecipient: string, + ): string { assert.isArray('orders', orders); assert.isArray('signatures', signatures); assert.isArray('feeOrders', feeOrders); assert.isArray('feeSignatures', feeSignatures); assert.isBigNumber('feePercentage', feePercentage); assert.isString('feeRecipient', feeRecipient); - const self = this as any as ForwarderContract; - const abiEncodedTransactionData = self._strictEncodeArguments('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase() - ]); + const self = (this as any) as ForwarderContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', + [orders, signatures, feeOrders, feeSignatures, feePercentage, feeRecipient.toLowerCase()], + ); return abiEncodedTransactionData; }, }; public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('newOwner', newOwner); - const self = this as any as ForwarderContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind( - self, - newOwner.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as ForwarderContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( newOwner: string, @@ -657,51 +963,41 @@ export class ForwarderContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('newOwner', newOwner); - const self = this as any as ForwarderContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('newOwner', newOwner); + const self = (this as any) as ForwarderContract; + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - newOwner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('newOwner', newOwner); - const self = this as any as ForwarderContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as ForwarderContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - newOwner: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -711,9 +1007,8 @@ export class ForwarderContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ForwarderContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); + const self = (this as any) as ForwarderContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -722,35 +1017,35 @@ export class ForwarderContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - newOwner: string, - ): string { + getABIEncodedTransactionData(newOwner: string): string { assert.isString('newOwner', newOwner); - const self = this as any as ForwarderContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); + const self = (this as any) as ForwarderContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ + newOwner.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; -public static async deployFrom0xArtifactAsync( + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, - _exchange: string, - _zrxAssetData: string, - _wethAssetData: string, + artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + _exchange: string, + _zrxAssetData: string, + _wethAssetData: string, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -763,11 +1058,22 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); - return ForwarderContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, _exchange, -_zrxAssetData, -_wethAssetData -); + const abiDependencies = _.mapValues( + artifactDependencies, + (artifactDependency: ContractArtifact | SimpleContractArtifact) => { + return artifactDependency.compilerOutput.abi; + }, + ); + return ForwarderContract.deployAsync( + bytecode, + abi, + provider, + txDefaults, + abiDependencies, + _exchange, + _zrxAssetData, + _wethAssetData, + ); } public static async deployAsync( bytecode: string, @@ -775,9 +1081,9 @@ _wethAssetData supportedProvider: SupportedProvider, txDefaults: Partial, abiDependencies: { [contractName: string]: ContractAbi }, - _exchange: string, - _zrxAssetData: string, - _wethAssetData: string, + _exchange: string, + _zrxAssetData: string, + _wethAssetData: string, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -787,26 +1093,17 @@ _wethAssetData ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_exchange, -_zrxAssetData, -_wethAssetData -] = BaseContract._formatABIDataItemList( + [_exchange, _zrxAssetData, _wethAssetData] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [_exchange, -_zrxAssetData, -_wethAssetData -], + [_exchange, _zrxAssetData, _wethAssetData], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_exchange, -_zrxAssetData, -_wethAssetData -]); + const txData = deployInfo.encode(bytecode, [_exchange, _zrxAssetData, _wethAssetData]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -814,21 +1111,22 @@ _wethAssetData logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`Forwarder successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ForwarderContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); - contractInstance.constructorArgs = [_exchange, -_zrxAssetData, -_wethAssetData -]; + const contractInstance = new ForwarderContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + abiDependencies, + ); + contractInstance.constructorArgs = [_exchange, _zrxAssetData, _wethAssetData]; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: false, inputs: [ { @@ -883,7 +1181,7 @@ _wethAssetData name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'makerAssetFillAmount', @@ -945,7 +1243,7 @@ _wethAssetData name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'feeSignatures', @@ -982,7 +1280,7 @@ _wethAssetData name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, { name: 'feeOrderFillResults', @@ -1004,14 +1302,14 @@ _wethAssetData name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, ], payable: true, stateMutability: 'payable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1024,16 +1322,14 @@ _wethAssetData }, ], name: 'withdrawAsset', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'owner', outputs: [ { @@ -1045,7 +1341,7 @@ _wethAssetData stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1100,7 +1396,7 @@ _wethAssetData name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'signatures', @@ -1158,7 +1454,7 @@ _wethAssetData name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'feeSignatures', @@ -1195,7 +1491,7 @@ _wethAssetData name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, { name: 'feeOrderFillResults', @@ -1217,14 +1513,14 @@ _wethAssetData name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, ], payable: true, stateMutability: 'payable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1233,13 +1529,12 @@ _wethAssetData }, ], name: 'transferOwnership', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { inputs: [ { name: '_exchange', @@ -1254,17 +1549,14 @@ _wethAssetData type: 'bytes', }, ], - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'constructor', }, - { - inputs: [ - ], - outputs: [ - ], + { + inputs: [], + outputs: [], payable: true, stateMutability: 'payable', type: 'fallback', @@ -1272,11 +1564,16 @@ _wethAssetData ] as ContractAbi; return abi; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { super('Forwarder', ForwarderContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 177f842968..c2bceb318a 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 @@ -1,7 +1,7 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract,PromiseWithTransactionHash } from '@0x/base-contract'; +import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -24,38 +24,30 @@ import * as ethers from 'ethers'; import * as _ from 'lodash'; // tslint:enable:no-unused-variable - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class IAssetProxyContract extends BaseContract { public addAuthorizedAddress = { - async sendTransactionAsync( - target: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('target', target); - const self = this as any as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.addAuthorizedAddress.estimateGasAsync.bind( - self, - target.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.addAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -63,51 +55,41 @@ export class IAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = this as any as IAssetProxyContract; - const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + const self = (this as any) as IAssetProxyContract; + const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - target: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('target', target); - const self = this as any as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - target: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('target', target); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -117,9 +99,8 @@ export class IAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() - ]); + const self = (this as any) as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -128,54 +109,47 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - target: string, - ): string { + getABIEncodedTransactionData(target: string): string { assert.isString('target', target); - const self = this as any as IAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() - ]); + const self = (this as any) as IAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [ + target.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public removeAuthorizedAddress = { - async sendTransactionAsync( - target: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('target', target); - const self = this as any as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddress.estimateGasAsync.bind( - self, - target.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -183,51 +157,41 @@ export class IAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = this as any as IAssetProxyContract; - const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + const self = (this as any) as IAssetProxyContract; + const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - target: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('target', target); - const self = this as any as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - target: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('target', target); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -237,9 +201,8 @@ export class IAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() - ]); + const self = (this as any) as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -248,24 +211,24 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - target: string, - ): string { + getABIEncodedTransactionData(target: string): string { assert.isString('target', target); - const self = this as any as IAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() - ]); + const self = (this as any) as IAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [ + target.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; @@ -273,33 +236,30 @@ export class IAssetProxyContract extends BaseContract { async sendTransactionAsync( target: string, index: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = this as any as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), - index - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind( - self, + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ target.toLowerCase(), - index - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + index, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(self, target.toLowerCase(), index), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -308,57 +268,59 @@ export class IAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = this as any as IAssetProxyContract; - const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync(target.toLowerCase(), - index - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as IAssetProxyContract; + const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync( + target.toLowerCase(), + index, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( target: string, index: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = this as any as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), - index - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ + target.toLowerCase(), + index, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( target: string, index: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('target', target); assert.isBigNumber('index', index); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -369,10 +331,11 @@ export class IAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), - index - ]); + const self = (this as any) as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ + target.toLowerCase(), + index, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -381,27 +344,26 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - target: string, - index: BigNumber, - ): string { + getABIEncodedTransactionData(target: string, index: BigNumber): string { assert.isString('target', target); assert.isBigNumber('index', index); - const self = this as any as IAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), - index - ]); + const self = (this as any) as IAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'removeAuthorizedAddressAtIndex(address,uint256)', + [target.toLowerCase(), index], + ); return abiEncodedTransactionData; }, }; @@ -411,39 +373,34 @@ export class IAssetProxyContract extends BaseContract { from: string, to: string, amount: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('assetData', assetData); - assert.isString('from', from); - assert.isString('to', to); - assert.isBigNumber('amount', amount); - const self = this as any as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [assetData, - from.toLowerCase(), - to.toLowerCase(), - amount - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind( - self, + assert.isString('assetData', assetData); + assert.isString('from', from); + assert.isString('to', to); + assert.isBigNumber('amount', amount); + const self = (this as any) as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [ assetData, from.toLowerCase(), to.toLowerCase(), - amount - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + amount, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferFrom.estimateGasAsync.bind(self, assetData, from.toLowerCase(), to.toLowerCase(), amount), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( assetData: string, @@ -454,27 +411,29 @@ export class IAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('assetData', assetData); - assert.isString('from', from); - assert.isString('to', to); - assert.isBigNumber('amount', amount); - const self = this as any as IAssetProxyContract; - const txHashPromise = self.transferFrom.sendTransactionAsync(assetData, - from.toLowerCase(), - to.toLowerCase(), - amount - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('assetData', assetData); + assert.isString('from', from); + assert.isString('to', to); + assert.isBigNumber('amount', amount); + const self = (this as any) as IAssetProxyContract; + const txHashPromise = self.transferFrom.sendTransactionAsync( + assetData, + from.toLowerCase(), + to.toLowerCase(), + amount, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( assetData: string, @@ -483,30 +442,31 @@ export class IAssetProxyContract extends BaseContract { amount: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('assetData', assetData); - assert.isString('from', from); - assert.isString('to', to); - assert.isBigNumber('amount', amount); - const self = this as any as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [assetData, - from.toLowerCase(), - to.toLowerCase(), - amount - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('assetData', assetData); + assert.isString('from', from); + assert.isString('to', to); + assert.isBigNumber('amount', amount); + const self = (this as any) as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [ + assetData, + from.toLowerCase(), + to.toLowerCase(), + amount, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( assetData: string, @@ -515,8 +475,7 @@ export class IAssetProxyContract extends BaseContract { amount: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('assetData', assetData); assert.isString('from', from); assert.isString('to', to); @@ -529,12 +488,13 @@ export class IAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [assetData, - from.toLowerCase(), - to.toLowerCase(), - amount - ]); + const self = (this as any) as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [ + assetData, + from.toLowerCase(), + to.toLowerCase(), + amount, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -543,42 +503,33 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(bytes,address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - assetData: string, - from: string, - to: string, - amount: BigNumber, - ): string { + getABIEncodedTransactionData(assetData: string, from: string, to: string, amount: BigNumber): string { assert.isString('assetData', assetData); assert.isString('from', from); assert.isString('to', to); assert.isBigNumber('amount', amount); - const self = this as any as IAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [assetData, - from.toLowerCase(), - to.toLowerCase(), - amount - ]); + const self = (this as any) as IAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'transferFrom(bytes,address,address,uint256)', + [assetData, from.toLowerCase(), to.toLowerCase(), amount], + ); return abiEncodedTransactionData; }, }; public getProxyId = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -587,7 +538,7 @@ export class IAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as IAssetProxyContract; + const self = (this as any) as IAssetProxyContract; const encodedData = self._strictEncodeArguments('getProxyId()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -597,30 +548,26 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getProxyId()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as IAssetProxyContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as IAssetProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('getProxyId()', []); return abiEncodedTransactionData; }, }; public getAuthorizedAddresses = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -629,7 +576,7 @@ export class IAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as IAssetProxyContract; + const self = (this as any) as IAssetProxyContract; const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -639,51 +586,44 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as IAssetProxyContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as IAssetProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('getAuthorizedAddresses()', []); return abiEncodedTransactionData; }, }; public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('newOwner', newOwner); - const self = this as any as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind( - self, - newOwner.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( newOwner: string, @@ -691,51 +631,41 @@ export class IAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('newOwner', newOwner); - const self = this as any as IAssetProxyContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('newOwner', newOwner); + const self = (this as any) as IAssetProxyContract; + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - newOwner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('newOwner', newOwner); - const self = this as any as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - newOwner: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -745,9 +675,8 @@ export class IAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); + const self = (this as any) as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -756,32 +685,32 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - newOwner: string, - ): string { + getABIEncodedTransactionData(newOwner: string): string { assert.isString('newOwner', newOwner); - const self = this as any as IAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); + const self = (this as any) as IAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ + newOwner.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; -public static async deployFrom0xArtifactAsync( + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -794,8 +723,13 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); - return IAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, ); + const abiDependencies = _.mapValues( + artifactDependencies, + (artifactDependency: ContractArtifact | SimpleContractArtifact) => { + return artifactDependency.compilerOutput.abi; + }, + ); + return IAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies); } public static async deployAsync( bytecode: string, @@ -812,17 +746,13 @@ public static async deployFrom0xArtifactAsync( ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); + [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -830,18 +760,22 @@ public static async deployFrom0xArtifactAsync( logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`IAssetProxy successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new IAssetProxyContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); + const contractInstance = new IAssetProxyContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + abiDependencies, + ); contractInstance.constructorArgs = []; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: false, inputs: [ { @@ -850,13 +784,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'addAuthorizedAddress', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -865,13 +798,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'removeAuthorizedAddress', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -884,13 +816,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'removeAuthorizedAddressAtIndex', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -911,16 +842,14 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'transferFrom', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'getProxyId', outputs: [ { @@ -932,10 +861,9 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'pure', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'getAuthorizedAddresses', outputs: [ { @@ -947,7 +875,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -956,8 +884,7 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'transferOwnership', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', @@ -965,11 +892,16 @@ public static async deployFrom0xArtifactAsync( ] as ContractAbi; return abi; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { super('IAssetProxy', IAssetProxyContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 ace17f02b1..6c292e4867 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts @@ -1,7 +1,7 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract,PromiseWithTransactionHash } from '@0x/base-contract'; +import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -24,7 +24,6 @@ import * as ethers from 'ethers'; import * as _ from 'lodash'; // tslint:enable:no-unused-variable - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name @@ -36,8 +35,7 @@ export class IValidatorContract extends BaseContract { signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('hash', hash); assert.isString('signerAddress', signerAddress); assert.isString('signature', signature); @@ -49,11 +47,12 @@ export class IValidatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as IValidatorContract; - const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [hash, - signerAddress.toLowerCase(), - signature - ]); + const self = (this as any) as IValidatorContract; + const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [ + hash, + signerAddress.toLowerCase(), + signature, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -62,38 +61,36 @@ export class IValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isValidSignature(bytes32,address,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - hash: string, - signerAddress: string, - signature: string, - ): string { + getABIEncodedTransactionData(hash: string, signerAddress: string, signature: string): string { assert.isString('hash', hash); assert.isString('signerAddress', signerAddress); assert.isString('signature', signature); - const self = this as any as IValidatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [hash, - signerAddress.toLowerCase(), - signature - ]); + const self = (this as any) as IValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [ + hash, + signerAddress.toLowerCase(), + signature, + ]); return abiEncodedTransactionData; }, }; -public static async deployFrom0xArtifactAsync( + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -106,8 +103,13 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); - return IValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, ); + const abiDependencies = _.mapValues( + artifactDependencies, + (artifactDependency: ContractArtifact | SimpleContractArtifact) => { + return artifactDependency.compilerOutput.abi; + }, + ); + return IValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies); } public static async deployAsync( bytecode: string, @@ -124,17 +126,13 @@ public static async deployFrom0xArtifactAsync( ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); + [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -142,18 +140,22 @@ public static async deployFrom0xArtifactAsync( logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`IValidator successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new IValidatorContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); + const contractInstance = new IValidatorContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + abiDependencies, + ); contractInstance.constructorArgs = []; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -183,11 +185,16 @@ public static async deployFrom0xArtifactAsync( ] as ContractAbi; return abi; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { super('IValidator', IValidatorContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 4b8ac08133..6b143c8ee8 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts @@ -1,7 +1,7 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract,PromiseWithTransactionHash } from '@0x/base-contract'; +import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -24,7 +24,6 @@ import * as ethers from 'ethers'; import * as _ from 'lodash'; // tslint:enable:no-unused-variable - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name @@ -35,8 +34,7 @@ export class IWalletContract extends BaseContract { signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('hash', hash); assert.isString('signature', signature); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -47,10 +45,8 @@ export class IWalletContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as IWalletContract; - const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,bytes)', [hash, - signature - ]); + const self = (this as any) as IWalletContract; + const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,bytes)', [hash, signature]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -59,35 +55,34 @@ export class IWalletContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isValidSignature(bytes32,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - hash: string, - signature: string, - ): string { + getABIEncodedTransactionData(hash: string, signature: string): string { assert.isString('hash', hash); assert.isString('signature', signature); - const self = this as any as IWalletContract; - const abiEncodedTransactionData = self._strictEncodeArguments('isValidSignature(bytes32,bytes)', [hash, - signature - ]); + const self = (this as any) as IWalletContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isValidSignature(bytes32,bytes)', [ + hash, + signature, + ]); return abiEncodedTransactionData; }, }; -public static async deployFrom0xArtifactAsync( + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -100,8 +95,13 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); - return IWalletContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, ); + const abiDependencies = _.mapValues( + artifactDependencies, + (artifactDependency: ContractArtifact | SimpleContractArtifact) => { + return artifactDependency.compilerOutput.abi; + }, + ); + return IWalletContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies); } public static async deployAsync( bytecode: string, @@ -118,17 +118,13 @@ public static async deployFrom0xArtifactAsync( ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); + [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -136,18 +132,22 @@ public static async deployFrom0xArtifactAsync( logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`IWallet successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new IWalletContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); + const contractInstance = new IWalletContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + abiDependencies, + ); contractInstance.constructorArgs = []; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -173,11 +173,16 @@ public static async deployFrom0xArtifactAsync( ] as ContractAbi; return abi; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { super('IWallet', IWalletContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 746cba577e..1449af3601 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 @@ -1,11 +1,14 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, +import { + BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; + SubscriptionManager, + PromiseWithTransactionHash, +} from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -55,18 +58,12 @@ export interface MultiAssetProxyAssetProxyRegisteredEventArgs extends DecodedLog assetProxy: string; } - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class MultiAssetProxyContract extends BaseContract { public assetProxies = { - async callAsync( - index_0: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(index_0: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -76,9 +73,8 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0 - ]); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -87,54 +83,45 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('assetProxies(bytes4)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: string, - ): string { + getABIEncodedTransactionData(index_0: string): string { assert.isString('index_0', index_0); - const self = this as any as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0 - ]); + const self = (this as any) as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0]); return abiEncodedTransactionData; }, }; public addAuthorizedAddress = { - async sendTransactionAsync( - target: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('target', target); - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.addAuthorizedAddress.estimateGasAsync.bind( - self, - target.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.addAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -142,51 +129,41 @@ export class MultiAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = this as any as MultiAssetProxyContract; - const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + const self = (this as any) as MultiAssetProxyContract; + const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - target: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('target', target); - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - target: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('target', target); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -196,9 +173,8 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() - ]); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -207,24 +183,24 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - target: string, - ): string { + getABIEncodedTransactionData(target: string): string { assert.isString('target', target); - const self = this as any as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() - ]); + const self = (this as any) as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [ + target.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; @@ -233,8 +209,7 @@ export class MultiAssetProxyContract extends BaseContract { index_0: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -244,9 +219,8 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0 - ]); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -255,24 +229,22 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: BigNumber, - ): string { + getABIEncodedTransactionData(index_0: BigNumber): string { assert.isBigNumber('index_0', index_0); - const self = this as any as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('authorities(uint256)', [index_0 - ]); + const self = (this as any) as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('authorities(uint256)', [index_0]); return abiEncodedTransactionData; }, }; @@ -281,8 +253,7 @@ export class MultiAssetProxyContract extends BaseContract { assetProxyId: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('assetProxyId', assetProxyId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -292,9 +263,8 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId - ]); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -303,54 +273,45 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAssetProxy(bytes4)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - assetProxyId: string, - ): string { + getABIEncodedTransactionData(assetProxyId: string): string { assert.isString('assetProxyId', assetProxyId); - const self = this as any as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId - ]); + const self = (this as any) as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId]); return abiEncodedTransactionData; }, }; public removeAuthorizedAddress = { - async sendTransactionAsync( - target: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('target', target); - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddress.estimateGasAsync.bind( - self, - target.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -358,51 +319,41 @@ export class MultiAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = this as any as MultiAssetProxyContract; - const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + const self = (this as any) as MultiAssetProxyContract; + const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - target: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('target', target); - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - target: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('target', target); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -412,9 +363,8 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() - ]); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -423,33 +373,29 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - target: string, - ): string { + getABIEncodedTransactionData(target: string): string { assert.isString('target', target); - const self = this as any as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() - ]); + const self = (this as any) as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [ + target.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public owner = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -458,7 +404,7 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as MultiAssetProxyContract; + const self = (this as any) as MultiAssetProxyContract; const encodedData = self._strictEncodeArguments('owner()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -468,20 +414,20 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as MultiAssetProxyContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as MultiAssetProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); return abiEncodedTransactionData; }, @@ -490,33 +436,30 @@ export class MultiAssetProxyContract extends BaseContract { async sendTransactionAsync( target: string, index: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), - index - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind( - self, + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ target.toLowerCase(), - index - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + index, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(self, target.toLowerCase(), index), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -525,57 +468,59 @@ export class MultiAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = this as any as MultiAssetProxyContract; - const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync(target.toLowerCase(), - index - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as MultiAssetProxyContract; + const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync( + target.toLowerCase(), + index, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( target: string, index: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), - index - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ + target.toLowerCase(), + index, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( target: string, index: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('target', target); assert.isBigNumber('index', index); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -586,10 +531,11 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), - index - ]); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ + target.toLowerCase(), + index, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -598,36 +544,31 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - target: string, - index: BigNumber, - ): string { + getABIEncodedTransactionData(target: string, index: BigNumber): string { assert.isString('target', target); assert.isBigNumber('index', index); - const self = this as any as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), - index - ]); + const self = (this as any) as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'removeAuthorizedAddressAtIndex(address,uint256)', + [target.toLowerCase(), index], + ); return abiEncodedTransactionData; }, }; public getProxyId = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -636,7 +577,7 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as MultiAssetProxyContract; + const self = (this as any) as MultiAssetProxyContract; const encodedData = self._strictEncodeArguments('getProxyId()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -646,20 +587,20 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getProxyId()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as MultiAssetProxyContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as MultiAssetProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('getProxyId()', []); return abiEncodedTransactionData; }, @@ -669,8 +610,7 @@ export class MultiAssetProxyContract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -680,9 +620,8 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase() - ]); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -691,54 +630,47 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorized(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: string, - ): string { + getABIEncodedTransactionData(index_0: string): string { assert.isString('index_0', index_0); - const self = this as any as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase() - ]); + const self = (this as any) as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [ + index_0.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public registerAssetProxy = { - async sendTransactionAsync( - assetProxy: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('assetProxy', assetProxy); - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.registerAssetProxy.estimateGasAsync.bind( - self, - assetProxy.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(assetProxy: string, txData?: Partial | undefined): Promise { + assert.isString('assetProxy', assetProxy); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.registerAssetProxy.estimateGasAsync.bind(self, assetProxy.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( assetProxy: string, @@ -746,51 +678,45 @@ export class MultiAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('assetProxy', assetProxy); - const self = this as any as MultiAssetProxyContract; - const txHashPromise = self.registerAssetProxy.sendTransactionAsync(assetProxy.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('assetProxy', assetProxy); + const self = (this as any) as MultiAssetProxyContract; + const txHashPromise = self.registerAssetProxy.sendTransactionAsync(assetProxy.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - assetProxy: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('assetProxy', assetProxy); - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(assetProxy: string, txData?: Partial | undefined): Promise { + assert.isString('assetProxy', assetProxy); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( assetProxy: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('assetProxy', assetProxy); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -800,9 +726,8 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase() - ]); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -811,33 +736,29 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - assetProxy: string, - ): string { + getABIEncodedTransactionData(assetProxy: string): string { assert.isString('assetProxy', assetProxy); - const self = this as any as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase() - ]); + const self = (this as any) as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address)', [ + assetProxy.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public getAuthorizedAddresses = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -846,7 +767,7 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as MultiAssetProxyContract; + const self = (this as any) as MultiAssetProxyContract; const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -856,51 +777,44 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as MultiAssetProxyContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as MultiAssetProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('getAuthorizedAddresses()', []); return abiEncodedTransactionData; }, }; public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('newOwner', newOwner); - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind( - self, - newOwner.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( newOwner: string, @@ -908,51 +822,41 @@ export class MultiAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('newOwner', newOwner); - const self = this as any as MultiAssetProxyContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('newOwner', newOwner); + const self = (this as any) as MultiAssetProxyContract; + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - newOwner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('newOwner', newOwner); - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - newOwner: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -962,9 +866,8 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -973,33 +876,33 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - newOwner: string, - ): string { + getABIEncodedTransactionData(newOwner: string): string { assert.isString('newOwner', newOwner); - const self = this as any as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); + const self = (this as any) as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ + newOwner.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; -private readonly _subscriptionManager: SubscriptionManager; -public static async deployFrom0xArtifactAsync( + private readonly _subscriptionManager: SubscriptionManager; + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -1012,8 +915,13 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); - return MultiAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, ); + const abiDependencies = _.mapValues( + artifactDependencies, + (artifactDependency: ContractArtifact | SimpleContractArtifact) => { + return artifactDependency.compilerOutput.abi; + }, + ); + return MultiAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies); } public static async deployAsync( bytecode: string, @@ -1030,17 +938,13 @@ public static async deployFrom0xArtifactAsync( ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); + [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -1048,18 +952,22 @@ public static async deployFrom0xArtifactAsync( logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`MultiAssetProxy successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new MultiAssetProxyContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); + const contractInstance = new MultiAssetProxyContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + abiDependencies, + ); contractInstance.constructorArgs = []; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -1078,7 +986,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1087,13 +995,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'addAuthorizedAddress', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1112,7 +1019,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1131,7 +1038,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1140,16 +1047,14 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'removeAuthorizedAddress', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'owner', outputs: [ { @@ -1161,7 +1066,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1174,16 +1079,14 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'removeAuthorizedAddressAtIndex', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'getProxyId', outputs: [ { @@ -1195,7 +1098,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'pure', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1214,7 +1117,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1223,16 +1126,14 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'registerAssetProxy', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'getAuthorizedAddresses', outputs: [ { @@ -1244,7 +1145,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1253,22 +1154,19 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'transferOwnership', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { - inputs: [ - ], - outputs: [ - ], + { + inputs: [], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'fallback', }, - { + { anonymous: false, inputs: [ { @@ -1283,11 +1181,10 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'AuthorizedAddressAdded', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1302,11 +1199,10 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'AuthorizedAddressRemoved', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1321,8 +1217,7 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'AssetProxyRegistered', - outputs: [ - ], + outputs: [], type: 'event', }, ] as ContractAbi; @@ -1396,15 +1291,27 @@ public static async deployFrom0xArtifactAsync( ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { - super('MultiAssetProxy', MultiAssetProxyContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { + super( + 'MultiAssetProxy', + MultiAssetProxyContract.ABI(), + address, + supportedProvider, + txDefaults, + logDecodeDependencies, + ); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( MultiAssetProxyContract.ABI(), this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 bd2513638d..a95b204c20 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts @@ -1,7 +1,7 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract,PromiseWithTransactionHash } from '@0x/base-contract'; +import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -24,20 +24,44 @@ import * as ethers from 'ethers'; import * as _ from 'lodash'; // tslint:enable:no-unused-variable - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class OrderValidatorContract extends BaseContract { public getOrderAndTraderInfo = { async callAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, takerAddress: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<[{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}, {makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}] + ): Promise< + [ + { orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }, + { + makerBalance: BigNumber; + makerAllowance: BigNumber; + takerBalance: BigNumber; + takerAllowance: BigNumber; + makerZrxBalance: BigNumber; + makerZrxAllowance: BigNumber; + takerZrxBalance: BigNumber; + takerZrxAllowance: BigNumber; + } + ] > { - assert.isString('takerAddress', takerAddress); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -47,10 +71,11 @@ export class OrderValidatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as OrderValidatorContract; - const encodedData = self._strictEncodeArguments('getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', [order, - takerAddress.toLowerCase() - ]); + const self = (this as any) as OrderValidatorContract; + const encodedData = self._strictEncodeArguments( + 'getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', + [order, takerAddress.toLowerCase()], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -59,27 +84,57 @@ export class OrderValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)'); + const abiEncoder = self._lookupAbiEncoder( + 'getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<[{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}, {makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}] - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue< + [ + { orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }, + { + makerBalance: BigNumber; + makerAllowance: BigNumber; + takerBalance: BigNumber; + takerAllowance: BigNumber; + makerZrxBalance: BigNumber; + makerZrxAllowance: BigNumber; + takerZrxBalance: BigNumber; + takerZrxAllowance: BigNumber; + } + ] + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAddress: string, - ): string { - + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, + takerAddress: string, + ): string { assert.isString('takerAddress', takerAddress); - const self = this as any as OrderValidatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', [order, - takerAddress.toLowerCase() - ]); + const self = (this as any) as OrderValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', + [order, takerAddress.toLowerCase()], + ); return abiEncodedTransactionData; }, }; @@ -89,8 +144,7 @@ export class OrderValidatorContract extends BaseContract { assetData: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<[BigNumber, BigNumber] - > { + ): Promise<[BigNumber, BigNumber]> { assert.isString('target', target); assert.isString('assetData', assetData); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -101,10 +155,11 @@ export class OrderValidatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as OrderValidatorContract; - const encodedData = self._strictEncodeArguments('getBalanceAndAllowance(address,bytes)', [target.toLowerCase(), - assetData - ]); + const self = (this as any) as OrderValidatorContract; + const encodedData = self._strictEncodeArguments('getBalanceAndAllowance(address,bytes)', [ + target.toLowerCase(), + assetData, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -113,37 +168,62 @@ export class OrderValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getBalanceAndAllowance(address,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<[BigNumber, BigNumber] - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<[BigNumber, BigNumber]>(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - target: string, - assetData: string, - ): string { + getABIEncodedTransactionData(target: string, assetData: string): string { assert.isString('target', target); assert.isString('assetData', assetData); - const self = this as any as OrderValidatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getBalanceAndAllowance(address,bytes)', [target.toLowerCase(), - assetData - ]); + const self = (this as any) as OrderValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getBalanceAndAllowance(address,bytes)', [ + target.toLowerCase(), + assetData, + ]); return abiEncodedTransactionData; }, }; public getOrdersAndTradersInfo = { async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAddresses: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<[Array<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}>, Array<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}>] + ): Promise< + [ + Array<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }>, + Array<{ + makerBalance: BigNumber; + makerAllowance: BigNumber; + takerBalance: BigNumber; + takerAllowance: BigNumber; + makerZrxBalance: BigNumber; + makerZrxAllowance: BigNumber; + takerZrxBalance: BigNumber; + takerZrxAllowance: BigNumber; + }> + ] > { assert.isArray('orders', orders); assert.isArray('takerAddresses', takerAddresses); @@ -155,10 +235,11 @@ export class OrderValidatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as OrderValidatorContract; - const encodedData = self._strictEncodeArguments('getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', [orders, - takerAddresses - ]); + const self = (this as any) as OrderValidatorContract; + const encodedData = self._strictEncodeArguments( + 'getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', + [orders, takerAddresses], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -167,37 +248,91 @@ export class OrderValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])'); + const abiEncoder = self._lookupAbiEncoder( + 'getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<[Array<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}>, Array<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}>] - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue< + [ + Array<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }>, + Array<{ + makerBalance: BigNumber; + makerAllowance: BigNumber; + takerBalance: BigNumber; + takerAllowance: BigNumber; + makerZrxBalance: BigNumber; + makerZrxAllowance: BigNumber; + takerZrxBalance: BigNumber; + takerZrxAllowance: BigNumber; + }> + ] + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAddresses: string[], - ): string { + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, + takerAddresses: string[], + ): string { assert.isArray('orders', orders); assert.isArray('takerAddresses', takerAddresses); - const self = this as any as OrderValidatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', [orders, - takerAddresses - ]); + const self = (this as any) as OrderValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', + [orders, takerAddresses], + ); return abiEncodedTransactionData; }, }; public getTradersInfo = { async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAddresses: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise + ): Promise< + Array<{ + makerBalance: BigNumber; + makerAllowance: BigNumber; + takerBalance: BigNumber; + takerAllowance: BigNumber; + makerZrxBalance: BigNumber; + makerZrxAllowance: BigNumber; + takerZrxBalance: BigNumber; + takerZrxAllowance: BigNumber; + }> > { assert.isArray('orders', orders); assert.isArray('takerAddresses', takerAddresses); @@ -209,10 +344,11 @@ export class OrderValidatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as OrderValidatorContract; - const encodedData = self._strictEncodeArguments('getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', [orders, - takerAddresses - ]); + const self = (this as any) as OrderValidatorContract; + const encodedData = self._strictEncodeArguments( + 'getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', + [orders, takerAddresses], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -221,27 +357,55 @@ export class OrderValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])'); + const abiEncoder = self._lookupAbiEncoder( + 'getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue< + Array<{ + makerBalance: BigNumber; + makerAllowance: BigNumber; + takerBalance: BigNumber; + takerAllowance: BigNumber; + makerZrxBalance: BigNumber; + makerZrxAllowance: BigNumber; + takerZrxBalance: BigNumber; + takerZrxAllowance: BigNumber; + }> + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAddresses: string[], - ): string { + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, + takerAddresses: string[], + ): string { assert.isArray('orders', orders); assert.isArray('takerAddresses', takerAddresses); - const self = this as any as OrderValidatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', [orders, - takerAddresses - ]); + const self = (this as any) as OrderValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', + [orders, takerAddresses], + ); return abiEncodedTransactionData; }, }; @@ -251,8 +415,7 @@ export class OrderValidatorContract extends BaseContract { tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('token', token); assert.isBigNumber('tokenId', tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -263,10 +426,11 @@ export class OrderValidatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as OrderValidatorContract; - const encodedData = self._strictEncodeArguments('getERC721TokenOwner(address,uint256)', [token.toLowerCase(), - tokenId - ]); + const self = (this as any) as OrderValidatorContract; + const encodedData = self._strictEncodeArguments('getERC721TokenOwner(address,uint256)', [ + token.toLowerCase(), + tokenId, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -275,27 +439,26 @@ export class OrderValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getERC721TokenOwner(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - token: string, - tokenId: BigNumber, - ): string { + getABIEncodedTransactionData(token: string, tokenId: BigNumber): string { assert.isString('token', token); assert.isBigNumber('tokenId', tokenId); - const self = this as any as OrderValidatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getERC721TokenOwner(address,uint256)', [token.toLowerCase(), - tokenId - ]); + const self = (this as any) as OrderValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getERC721TokenOwner(address,uint256)', [ + token.toLowerCase(), + tokenId, + ]); return abiEncodedTransactionData; }, }; @@ -305,8 +468,7 @@ export class OrderValidatorContract extends BaseContract { assetData: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<[BigNumber[], BigNumber[]] - > { + ): Promise<[BigNumber[], BigNumber[]]> { assert.isString('target', target); assert.isArray('assetData', assetData); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -317,10 +479,11 @@ export class OrderValidatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as OrderValidatorContract; - const encodedData = self._strictEncodeArguments('getBalancesAndAllowances(address,bytes[])', [target.toLowerCase(), - assetData - ]); + const self = (this as any) as OrderValidatorContract; + const encodedData = self._strictEncodeArguments('getBalancesAndAllowances(address,bytes[])', [ + target.toLowerCase(), + assetData, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -329,39 +492,58 @@ export class OrderValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getBalancesAndAllowances(address,bytes[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<[BigNumber[], BigNumber[]] - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<[BigNumber[], BigNumber[]]>(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - target: string, - assetData: string[], - ): string { + getABIEncodedTransactionData(target: string, assetData: string[]): string { assert.isString('target', target); assert.isArray('assetData', assetData); - const self = this as any as OrderValidatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getBalancesAndAllowances(address,bytes[])', [target.toLowerCase(), - assetData - ]); + const self = (this as any) as OrderValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getBalancesAndAllowances(address,bytes[])', [ + target.toLowerCase(), + assetData, + ]); return abiEncodedTransactionData; }, }; public getTraderInfo = { async callAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, takerAddress: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber} - > { - + ): Promise<{ + makerBalance: BigNumber; + makerAllowance: BigNumber; + takerBalance: BigNumber; + takerAllowance: BigNumber; + makerZrxBalance: BigNumber; + makerZrxAllowance: BigNumber; + takerZrxBalance: BigNumber; + takerZrxAllowance: BigNumber; + }> { assert.isString('takerAddress', takerAddress); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -371,10 +553,11 @@ export class OrderValidatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as OrderValidatorContract; - const encodedData = self._strictEncodeArguments('getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', [order, - takerAddress.toLowerCase() - ]); + const self = (this as any) as OrderValidatorContract; + const encodedData = self._strictEncodeArguments( + 'getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', + [order, takerAddress.toLowerCase()], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -383,37 +566,62 @@ export class OrderValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)'); + const abiEncoder = self._lookupAbiEncoder( + 'getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber} - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{ + makerBalance: BigNumber; + makerAllowance: BigNumber; + takerBalance: BigNumber; + takerAllowance: BigNumber; + makerZrxBalance: BigNumber; + makerZrxAllowance: BigNumber; + takerZrxBalance: BigNumber; + takerZrxAllowance: BigNumber; + }>(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAddress: string, - ): string { - + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, + takerAddress: string, + ): string { assert.isString('takerAddress', takerAddress); - const self = this as any as OrderValidatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', [order, - takerAddress.toLowerCase() - ]); + const self = (this as any) as OrderValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', + [order, takerAddress.toLowerCase()], + ); return abiEncodedTransactionData; }, }; -public static async deployFrom0xArtifactAsync( + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, - _exchange: string, - _zrxAssetData: string, + artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + _exchange: string, + _zrxAssetData: string, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -426,10 +634,21 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); - return OrderValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, _exchange, -_zrxAssetData -); + const abiDependencies = _.mapValues( + artifactDependencies, + (artifactDependency: ContractArtifact | SimpleContractArtifact) => { + return artifactDependency.compilerOutput.abi; + }, + ); + return OrderValidatorContract.deployAsync( + bytecode, + abi, + provider, + txDefaults, + abiDependencies, + _exchange, + _zrxAssetData, + ); } public static async deployAsync( bytecode: string, @@ -437,8 +656,8 @@ _zrxAssetData supportedProvider: SupportedProvider, txDefaults: Partial, abiDependencies: { [contractName: string]: ContractAbi }, - _exchange: string, - _zrxAssetData: string, + _exchange: string, + _zrxAssetData: string, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -448,23 +667,17 @@ _zrxAssetData ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_exchange, -_zrxAssetData -] = BaseContract._formatABIDataItemList( + [_exchange, _zrxAssetData] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [_exchange, -_zrxAssetData -], + [_exchange, _zrxAssetData], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_exchange, -_zrxAssetData -]); + const txData = deployInfo.encode(bytecode, [_exchange, _zrxAssetData]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -472,20 +685,22 @@ _zrxAssetData logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`OrderValidator successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new OrderValidatorContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); - contractInstance.constructorArgs = [_exchange, -_zrxAssetData -]; + const contractInstance = new OrderValidatorContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + abiDependencies, + ); + contractInstance.constructorArgs = [_exchange, _zrxAssetData]; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -540,7 +755,7 @@ _zrxAssetData name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'takerAddress', @@ -565,7 +780,7 @@ _zrxAssetData name: 'orderTakerAssetFilledAmount', type: 'uint256', }, - ] + ], }, { name: 'traderInfo', @@ -603,14 +818,14 @@ _zrxAssetData name: 'takerZrxAllowance', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -637,7 +852,7 @@ _zrxAssetData stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -692,7 +907,7 @@ _zrxAssetData name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'takerAddresses', @@ -717,7 +932,7 @@ _zrxAssetData name: 'orderTakerAssetFilledAmount', type: 'uint256', }, - ] + ], }, { name: 'tradersInfo', @@ -755,14 +970,14 @@ _zrxAssetData name: 'takerZrxAllowance', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -817,7 +1032,7 @@ _zrxAssetData name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'takerAddresses', @@ -862,14 +1077,14 @@ _zrxAssetData name: 'takerZrxAllowance', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -892,7 +1107,7 @@ _zrxAssetData stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -919,7 +1134,7 @@ _zrxAssetData stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -974,7 +1189,7 @@ _zrxAssetData name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'takerAddress', @@ -1019,14 +1234,14 @@ _zrxAssetData name: 'takerZrxAllowance', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'view', type: 'function', }, - { + { inputs: [ { name: '_exchange', @@ -1037,8 +1252,7 @@ _zrxAssetData type: 'bytes', }, ], - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'constructor', @@ -1046,11 +1260,23 @@ _zrxAssetData ] as ContractAbi; return abi; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { - super('OrderValidator', OrderValidatorContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { + super( + 'OrderValidator', + OrderValidatorContract.ABI(), + address, + supportedProvider, + txDefaults, + logDecodeDependencies, + ); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts b/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts index dcb129edf7..c7db77be2c 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts @@ -1,11 +1,14 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, +import { + BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; + SubscriptionManager, + PromiseWithTransactionHash, +} from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -64,17 +67,12 @@ export interface WETH9WithdrawalEventArgs extends DecodedLogArgs { _value: BigNumber; } - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class WETH9Contract extends BaseContract { public name = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -83,7 +81,7 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as WETH9Contract; + const self = (this as any) as WETH9Contract; const encodedData = self._strictEncodeArguments('name()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -93,55 +91,45 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('name()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as WETH9Contract; + getABIEncodedTransactionData(): string { + const self = (this as any) as WETH9Contract; const abiEncodedTransactionData = self._strictEncodeArguments('name()', []); return abiEncodedTransactionData; }, }; public approve = { - async sendTransactionAsync( - guy: string, - wad: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isString('guy', guy); - assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy.toLowerCase(), - wad - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind( - self, - guy.toLowerCase(), - wad - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(guy: string, wad: BigNumber, txData?: Partial | undefined): Promise { + assert.isString('guy', guy); + assert.isBigNumber('wad', wad); + const self = (this as any) as WETH9Contract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy.toLowerCase(), wad]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.approve.estimateGasAsync.bind(self, guy.toLowerCase(), wad), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( guy: string, @@ -150,57 +138,48 @@ export class WETH9Contract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('guy', guy); - assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const txHashPromise = self.approve.sendTransactionAsync(guy.toLowerCase(), - wad - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('guy', guy); + assert.isBigNumber('wad', wad); + const self = (this as any) as WETH9Contract; + const txHashPromise = self.approve.sendTransactionAsync(guy.toLowerCase(), wad, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - guy: string, - wad: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isString('guy', guy); - assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy.toLowerCase(), - wad - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(guy: string, wad: BigNumber, txData?: Partial | undefined): Promise { + assert.isString('guy', guy); + assert.isBigNumber('wad', wad); + const self = (this as any) as WETH9Contract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy.toLowerCase(), wad]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( guy: string, wad: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('guy', guy); assert.isBigNumber('wad', wad); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -211,10 +190,8 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy.toLowerCase(), - wad - ]); + const self = (this as any) as WETH9Contract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy.toLowerCase(), wad]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -223,36 +200,31 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - guy: string, - wad: BigNumber, - ): string { + getABIEncodedTransactionData(guy: string, wad: BigNumber): string { assert.isString('guy', guy); assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [guy.toLowerCase(), - wad - ]); + const self = (this as any) as WETH9Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [ + guy.toLowerCase(), + wad, + ]); return abiEncodedTransactionData; }, }; public totalSupply = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -261,7 +233,7 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as WETH9Contract; + const self = (this as any) as WETH9Contract; const encodedData = self._strictEncodeArguments('totalSupply()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -271,20 +243,20 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('totalSupply()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as WETH9Contract; + getABIEncodedTransactionData(): string { + const self = (this as any) as WETH9Contract; const abiEncodedTransactionData = self._strictEncodeArguments('totalSupply()', []); return abiEncodedTransactionData; }, @@ -294,36 +266,32 @@ export class WETH9Contract extends BaseContract { src: string, dst: string, wad: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('src', src); - assert.isString('dst', dst); - assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [src.toLowerCase(), - dst.toLowerCase(), - wad - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind( - self, + assert.isString('src', src); + assert.isString('dst', dst); + assert.isBigNumber('wad', wad); + const self = (this as any) as WETH9Contract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ src.toLowerCase(), dst.toLowerCase(), - wad - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + wad, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferFrom.estimateGasAsync.bind(self, src.toLowerCase(), dst.toLowerCase(), wad), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( src: string, @@ -333,25 +301,27 @@ export class WETH9Contract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('src', src); - assert.isString('dst', dst); - assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const txHashPromise = self.transferFrom.sendTransactionAsync(src.toLowerCase(), - dst.toLowerCase(), - wad - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('src', src); + assert.isString('dst', dst); + assert.isBigNumber('wad', wad); + const self = (this as any) as WETH9Contract; + const txHashPromise = self.transferFrom.sendTransactionAsync( + src.toLowerCase(), + dst.toLowerCase(), + wad, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( src: string, @@ -359,28 +329,29 @@ export class WETH9Contract extends BaseContract { wad: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('src', src); - assert.isString('dst', dst); - assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [src.toLowerCase(), - dst.toLowerCase(), - wad - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('src', src); + assert.isString('dst', dst); + assert.isBigNumber('wad', wad); + const self = (this as any) as WETH9Contract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + src.toLowerCase(), + dst.toLowerCase(), + wad, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( src: string, @@ -388,8 +359,7 @@ export class WETH9Contract extends BaseContract { wad: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('src', src); assert.isString('dst', dst); assert.isBigNumber('wad', wad); @@ -401,11 +371,12 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [src.toLowerCase(), - dst.toLowerCase(), - wad - ]); + const self = (this as any) as WETH9Contract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + src.toLowerCase(), + dst.toLowerCase(), + wad, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -414,60 +385,51 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - src: string, - dst: string, - wad: BigNumber, - ): string { + getABIEncodedTransactionData(src: string, dst: string, wad: BigNumber): string { assert.isString('src', src); assert.isString('dst', dst); assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [src.toLowerCase(), - dst.toLowerCase(), - wad - ]); + const self = (this as any) as WETH9Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + src.toLowerCase(), + dst.toLowerCase(), + wad, + ]); return abiEncodedTransactionData; }, }; public withdraw = { - async sendTransactionAsync( - wad: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.withdraw.estimateGasAsync.bind( - self, - wad - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(wad: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('wad', wad); + const self = (this as any) as WETH9Contract; + const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.withdraw.estimateGasAsync.bind(self, wad), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( wad: BigNumber, @@ -475,51 +437,41 @@ export class WETH9Contract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const txHashPromise = self.withdraw.sendTransactionAsync(wad - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('wad', wad); + const self = (this as any) as WETH9Contract; + const txHashPromise = self.withdraw.sendTransactionAsync(wad, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - wad: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(wad: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('wad', wad); + const self = (this as any) as WETH9Contract; + const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - wad: BigNumber, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(wad: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isBigNumber('wad', wad); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -529,9 +481,8 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad - ]); + const self = (this as any) as WETH9Contract; + const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -540,33 +491,27 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('withdraw(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - wad: BigNumber, - ): string { + getABIEncodedTransactionData(wad: BigNumber): string { assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('withdraw(uint256)', [wad - ]); + const self = (this as any) as WETH9Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('withdraw(uint256)', [wad]); return abiEncodedTransactionData; }, }; public decimals = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -575,7 +520,7 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as WETH9Contract; + const self = (this as any) as WETH9Contract; const encodedData = self._strictEncodeArguments('decimals()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -585,20 +530,20 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('decimals()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as WETH9Contract; + getABIEncodedTransactionData(): string { + const self = (this as any) as WETH9Contract; const abiEncodedTransactionData = self._strictEncodeArguments('decimals()', []); return abiEncodedTransactionData; }, @@ -608,8 +553,7 @@ export class WETH9Contract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -619,9 +563,8 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [index_0.toLowerCase() - ]); + const self = (this as any) as WETH9Contract; + const encodedData = self._strictEncodeArguments('balanceOf(address)', [index_0.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -630,33 +573,29 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: string, - ): string { + getABIEncodedTransactionData(index_0: string): string { assert.isString('index_0', index_0); - const self = this as any as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [index_0.toLowerCase() - ]); + const self = (this as any) as WETH9Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [ + index_0.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public symbol = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -665,7 +604,7 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as WETH9Contract; + const self = (this as any) as WETH9Contract; const encodedData = self._strictEncodeArguments('symbol()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -675,55 +614,45 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('symbol()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as WETH9Contract; + getABIEncodedTransactionData(): string { + const self = (this as any) as WETH9Contract; const abiEncodedTransactionData = self._strictEncodeArguments('symbol()', []); return abiEncodedTransactionData; }, }; public transfer = { - async sendTransactionAsync( - dst: string, - wad: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isString('dst', dst); - assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst.toLowerCase(), - wad - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transfer.estimateGasAsync.bind( - self, - dst.toLowerCase(), - wad - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(dst: string, wad: BigNumber, txData?: Partial | undefined): Promise { + assert.isString('dst', dst); + assert.isBigNumber('wad', wad); + const self = (this as any) as WETH9Contract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst.toLowerCase(), wad]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transfer.estimateGasAsync.bind(self, dst.toLowerCase(), wad), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( dst: string, @@ -732,57 +661,48 @@ export class WETH9Contract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('dst', dst); - assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const txHashPromise = self.transfer.sendTransactionAsync(dst.toLowerCase(), - wad - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('dst', dst); + assert.isBigNumber('wad', wad); + const self = (this as any) as WETH9Contract; + const txHashPromise = self.transfer.sendTransactionAsync(dst.toLowerCase(), wad, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - dst: string, - wad: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isString('dst', dst); - assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst.toLowerCase(), - wad - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(dst: string, wad: BigNumber, txData?: Partial | undefined): Promise { + assert.isString('dst', dst); + assert.isBigNumber('wad', wad); + const self = (this as any) as WETH9Contract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst.toLowerCase(), wad]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( dst: string, wad: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('dst', dst); assert.isBigNumber('wad', wad); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -793,10 +713,8 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst.toLowerCase(), - wad - ]); + const self = (this as any) as WETH9Contract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst.toLowerCase(), wad]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -805,98 +723,87 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - dst: string, - wad: BigNumber, - ): string { + getABIEncodedTransactionData(dst: string, wad: BigNumber): string { assert.isString('dst', dst); assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [dst.toLowerCase(), - wad - ]); + const self = (this as any) as WETH9Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [ + dst.toLowerCase(), + wad, + ]); return abiEncodedTransactionData; }, }; public deposit = { - async sendTransactionAsync( - txData?: Partial | undefined, - ): Promise { - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('deposit()', []); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.deposit.estimateGasAsync.bind( - self, - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(txData?: Partial | undefined): Promise { + const self = (this as any) as WETH9Contract; + const encodedData = self._strictEncodeArguments('deposit()', []); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.deposit.estimateGasAsync.bind(self), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - const self = this as any as WETH9Contract; - const txHashPromise = self.deposit.sendTransactionAsync(txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + const self = (this as any) as WETH9Contract; + const txHashPromise = self.deposit.sendTransactionAsync(txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - txData?: Partial | undefined, - ): Promise { - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('deposit()', []); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(txData?: Partial | undefined): Promise { + const self = (this as any) as WETH9Contract; + const encodedData = self._strictEncodeArguments('deposit()', []); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -905,7 +812,7 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as WETH9Contract; + const self = (this as any) as WETH9Contract; const encodedData = self._strictEncodeArguments('deposit()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -915,20 +822,20 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('deposit()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as WETH9Contract; + getABIEncodedTransactionData(): string { + const self = (this as any) as WETH9Contract; const abiEncodedTransactionData = self._strictEncodeArguments('deposit()', []); return abiEncodedTransactionData; }, @@ -939,8 +846,7 @@ export class WETH9Contract extends BaseContract { index_1: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.isString('index_1', index_1); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -951,10 +857,11 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('allowance(address,address)', [index_0.toLowerCase(), - index_1.toLowerCase() - ]); + const self = (this as any) as WETH9Contract; + const encodedData = self._strictEncodeArguments('allowance(address,address)', [ + index_0.toLowerCase(), + index_1.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -963,36 +870,35 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: string, - index_1: string, - ): string { + getABIEncodedTransactionData(index_0: string, index_1: string): string { assert.isString('index_0', index_0); assert.isString('index_1', index_1); - const self = this as any as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [index_0.toLowerCase(), - index_1.toLowerCase() - ]); + const self = (this as any) as WETH9Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [ + index_0.toLowerCase(), + index_1.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; -private readonly _subscriptionManager: SubscriptionManager; -public static async deployFrom0xArtifactAsync( + private readonly _subscriptionManager: SubscriptionManager; + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -1005,8 +911,13 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); - return WETH9Contract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, ); + const abiDependencies = _.mapValues( + artifactDependencies, + (artifactDependency: ContractArtifact | SimpleContractArtifact) => { + return artifactDependency.compilerOutput.abi; + }, + ); + return WETH9Contract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies); } public static async deployAsync( bytecode: string, @@ -1023,17 +934,13 @@ public static async deployFrom0xArtifactAsync( ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); + [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -1041,21 +948,24 @@ public static async deployFrom0xArtifactAsync( logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`WETH9 successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new WETH9Contract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); + const contractInstance = new WETH9Contract( + txReceipt.contractAddress as string, + provider, + txDefaults, + abiDependencies, + ); contractInstance.constructorArgs = []; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'name', outputs: [ { @@ -1067,7 +977,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1090,10 +1000,9 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'totalSupply', outputs: [ { @@ -1105,7 +1014,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1132,7 +1041,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1141,16 +1050,14 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'withdraw', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'decimals', outputs: [ { @@ -1162,7 +1069,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1181,10 +1088,9 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'symbol', outputs: [ { @@ -1196,7 +1102,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1219,18 +1125,16 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, - inputs: [ - ], + inputs: [], name: 'deposit', - outputs: [ - ], + outputs: [], payable: true, stateMutability: 'payable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1253,16 +1157,14 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { - inputs: [ - ], - outputs: [ - ], + { + inputs: [], + outputs: [], payable: true, stateMutability: 'payable', type: 'fallback', }, - { + { anonymous: false, inputs: [ { @@ -1282,11 +1184,10 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'Approval', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1306,11 +1207,10 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'Transfer', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1325,11 +1225,10 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'Deposit', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1344,8 +1243,7 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'Withdrawal', - outputs: [ - ], + outputs: [], type: 'event', }, ] as ContractAbi; @@ -1419,7 +1317,12 @@ public static async deployFrom0xArtifactAsync( ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { super('WETH9', WETH9Contract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( @@ -1427,7 +1330,7 @@ public static async deployFrom0xArtifactAsync( this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 90feb73946..ceaad03979 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts @@ -1,11 +1,14 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, +import { + BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; + SubscriptionManager, + PromiseWithTransactionHash, +} from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -29,9 +32,7 @@ import * as ethers from 'ethers'; import * as _ from 'lodash'; // tslint:enable:no-unused-variable -export type ZRXTokenEventArgs = - | ZRXTokenTransferEventArgs - | ZRXTokenApprovalEventArgs; +export type ZRXTokenEventArgs = ZRXTokenTransferEventArgs | ZRXTokenApprovalEventArgs; export enum ZRXTokenEvents { Transfer = 'Transfer', @@ -50,17 +51,12 @@ export interface ZRXTokenApprovalEventArgs extends DecodedLogArgs { _value: BigNumber; } - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class ZRXTokenContract extends BaseContract { public name = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -69,7 +65,7 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ZRXTokenContract; + const self = (this as any) as ZRXTokenContract; const encodedData = self._strictEncodeArguments('name()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -79,20 +75,20 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('name()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as ZRXTokenContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as ZRXTokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('name()', []); return abiEncodedTransactionData; }, @@ -101,33 +97,30 @@ export class ZRXTokenContract extends BaseContract { async sendTransactionAsync( _spender: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = this as any as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind( - self, + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = (this as any) as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ _spender.toLowerCase(), - _value - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _value, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.approve.estimateGasAsync.bind(self, _spender.toLowerCase(), _value), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _spender: string, @@ -136,57 +129,55 @@ export class ZRXTokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = this as any as ZRXTokenContract; - const txHashPromise = self.approve.sendTransactionAsync(_spender.toLowerCase(), - _value - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = (this as any) as ZRXTokenContract; + const txHashPromise = self.approve.sendTransactionAsync(_spender.toLowerCase(), _value, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _spender: string, _value: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = this as any as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = (this as any) as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + _spender.toLowerCase(), + _value, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _spender: string, _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -197,10 +188,11 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), - _value - ]); + const self = (this as any) as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + _spender.toLowerCase(), + _value, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -209,36 +201,31 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _spender: string, - _value: BigNumber, - ): string { + getABIEncodedTransactionData(_spender: string, _value: BigNumber): string { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); - const self = this as any as ZRXTokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), - _value - ]); + const self = (this as any) as ZRXTokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [ + _spender.toLowerCase(), + _value, + ]); return abiEncodedTransactionData; }, }; public totalSupply = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -247,7 +234,7 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ZRXTokenContract; + const self = (this as any) as ZRXTokenContract; const encodedData = self._strictEncodeArguments('totalSupply()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -257,20 +244,20 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('totalSupply()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as ZRXTokenContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as ZRXTokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('totalSupply()', []); return abiEncodedTransactionData; }, @@ -280,36 +267,32 @@ export class ZRXTokenContract extends BaseContract { _from: string, _to: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind( - self, + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ _from.toLowerCase(), _to.toLowerCase(), - _value - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _value, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferFrom.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _value), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -319,25 +302,27 @@ export class ZRXTokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as ZRXTokenContract; - const txHashPromise = self.transferFrom.sendTransactionAsync(_from.toLowerCase(), - _to.toLowerCase(), - _value - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as ZRXTokenContract; + const txHashPromise = self.transferFrom.sendTransactionAsync( + _from.toLowerCase(), + _to.toLowerCase(), + _value, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -345,28 +330,29 @@ export class ZRXTokenContract extends BaseContract { _value: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _value, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -374,8 +360,7 @@ export class ZRXTokenContract extends BaseContract { _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_value', _value); @@ -387,11 +372,12 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _value - ]); + const self = (this as any) as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _value, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -400,39 +386,33 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _value: BigNumber, - ): string { + getABIEncodedTransactionData(_from: string, _to: string, _value: BigNumber): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_value', _value); - const self = this as any as ZRXTokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _value - ]); + const self = (this as any) as ZRXTokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _value, + ]); return abiEncodedTransactionData; }, }; public decimals = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -441,7 +421,7 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ZRXTokenContract; + const self = (this as any) as ZRXTokenContract; const encodedData = self._strictEncodeArguments('decimals()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -451,20 +431,20 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('decimals()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as ZRXTokenContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as ZRXTokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('decimals()', []); return abiEncodedTransactionData; }, @@ -474,8 +454,7 @@ export class ZRXTokenContract extends BaseContract { _owner: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -485,9 +464,8 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() - ]); + const self = (this as any) as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -496,33 +474,27 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _owner: string, - ): string { + getABIEncodedTransactionData(_owner: string): string { assert.isString('_owner', _owner); - const self = this as any as ZRXTokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() - ]); + const self = (this as any) as ZRXTokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); return abiEncodedTransactionData; }, }; public symbol = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -531,7 +503,7 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ZRXTokenContract; + const self = (this as any) as ZRXTokenContract; const encodedData = self._strictEncodeArguments('symbol()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -541,20 +513,20 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('symbol()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as ZRXTokenContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as ZRXTokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('symbol()', []); return abiEncodedTransactionData; }, @@ -563,33 +535,27 @@ export class ZRXTokenContract extends BaseContract { async sendTransactionAsync( _to: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transfer.estimateGasAsync.bind( - self, - _to.toLowerCase(), - _value - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transfer.estimateGasAsync.bind(self, _to.toLowerCase(), _value), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _to: string, @@ -598,57 +564,48 @@ export class ZRXTokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as ZRXTokenContract; - const txHashPromise = self.transfer.sendTransactionAsync(_to.toLowerCase(), - _value - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as ZRXTokenContract; + const txHashPromise = self.transfer.sendTransactionAsync(_to.toLowerCase(), _value, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - _to: string, - _value: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(_to: string, _value: BigNumber, txData?: Partial | undefined): Promise { + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _to: string, _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_to', _to); assert.isBigNumber('_value', _value); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -659,10 +616,8 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), - _value - ]); + const self = (this as any) as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -671,27 +626,26 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _to: string, - _value: BigNumber, - ): string { + getABIEncodedTransactionData(_to: string, _value: BigNumber): string { assert.isString('_to', _to); assert.isBigNumber('_value', _value); - const self = this as any as ZRXTokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), - _value - ]); + const self = (this as any) as ZRXTokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [ + _to.toLowerCase(), + _value, + ]); return abiEncodedTransactionData; }, }; @@ -701,8 +655,7 @@ export class ZRXTokenContract extends BaseContract { _spender: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.isString('_spender', _spender); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -713,10 +666,11 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('allowance(address,address)', [_owner.toLowerCase(), - _spender.toLowerCase() - ]); + const self = (this as any) as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('allowance(address,address)', [ + _owner.toLowerCase(), + _spender.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -725,36 +679,35 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _owner: string, - _spender: string, - ): string { + getABIEncodedTransactionData(_owner: string, _spender: string): string { assert.isString('_owner', _owner); assert.isString('_spender', _spender); - const self = this as any as ZRXTokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [_owner.toLowerCase(), - _spender.toLowerCase() - ]); + const self = (this as any) as ZRXTokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [ + _owner.toLowerCase(), + _spender.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; -private readonly _subscriptionManager: SubscriptionManager; -public static async deployFrom0xArtifactAsync( + private readonly _subscriptionManager: SubscriptionManager; + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -767,8 +720,13 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); - return ZRXTokenContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, ); + const abiDependencies = _.mapValues( + artifactDependencies, + (artifactDependency: ContractArtifact | SimpleContractArtifact) => { + return artifactDependency.compilerOutput.abi; + }, + ); + return ZRXTokenContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies); } public static async deployAsync( bytecode: string, @@ -785,17 +743,13 @@ public static async deployFrom0xArtifactAsync( ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); + [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -803,21 +757,24 @@ public static async deployFrom0xArtifactAsync( logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`ZRXToken successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ZRXTokenContract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); + const contractInstance = new ZRXTokenContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + abiDependencies, + ); contractInstance.constructorArgs = []; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'name', outputs: [ { @@ -828,7 +785,7 @@ public static async deployFrom0xArtifactAsync( payable: false, type: 'function', }, - { + { constant: false, inputs: [ { @@ -850,10 +807,9 @@ public static async deployFrom0xArtifactAsync( payable: false, type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'totalSupply', outputs: [ { @@ -864,7 +820,7 @@ public static async deployFrom0xArtifactAsync( payable: false, type: 'function', }, - { + { constant: false, inputs: [ { @@ -890,10 +846,9 @@ public static async deployFrom0xArtifactAsync( payable: false, type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'decimals', outputs: [ { @@ -904,7 +859,7 @@ public static async deployFrom0xArtifactAsync( payable: false, type: 'function', }, - { + { constant: true, inputs: [ { @@ -922,10 +877,9 @@ public static async deployFrom0xArtifactAsync( payable: false, type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'symbol', outputs: [ { @@ -936,7 +890,7 @@ public static async deployFrom0xArtifactAsync( payable: false, type: 'function', }, - { + { constant: false, inputs: [ { @@ -958,7 +912,7 @@ public static async deployFrom0xArtifactAsync( payable: false, type: 'function', }, - { + { constant: true, inputs: [ { @@ -980,15 +934,13 @@ public static async deployFrom0xArtifactAsync( payable: false, type: 'function', }, - { - inputs: [ - ], - outputs: [ - ], + { + inputs: [], + outputs: [], payable: false, type: 'constructor', }, - { + { anonymous: false, inputs: [ { @@ -1008,11 +960,10 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'Transfer', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1032,8 +983,7 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'Approval', - outputs: [ - ], + outputs: [], type: 'event', }, ] as ContractAbi; @@ -1107,7 +1057,12 @@ public static async deployFrom0xArtifactAsync( ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { super('ZRXToken', ZRXTokenContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( @@ -1115,7 +1070,7 @@ public static async deployFrom0xArtifactAsync( this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align diff --git a/packages/abi-gen/test-cli/expected-output/typescript/abi_gen_dummy.ts b/packages/abi-gen/test-cli/expected-output/typescript/abi_gen_dummy.ts index cb741017c4..0f7348cb9f 100644 --- a/packages/abi-gen/test-cli/expected-output/typescript/abi_gen_dummy.ts +++ b/packages/abi-gen/test-cli/expected-output/typescript/abi_gen_dummy.ts @@ -29,6 +29,7 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; +import * as _ from 'lodash'; // tslint:enable:no-unused-variable export type AbiGenDummyEventArgs = AbiGenDummyWithdrawalEventArgs | AbiGenDummyAnEventEventArgs; @@ -1022,6 +1023,7 @@ export class AbiGenDummyContract extends BaseContract { artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, + artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -1034,13 +1036,20 @@ export class AbiGenDummyContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - return AbiGenDummyContract.deployAsync(bytecode, abi, provider, txDefaults); + const abiDependencies = _.mapValues( + artifactDependencies, + (artifactDependency: ContractArtifact | SimpleContractArtifact) => { + return artifactDependency.compilerOutput.abi; + }, + ); + return AbiGenDummyContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, + abiDependencies: { [contractName: string]: ContractAbi }, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -1064,7 +1073,12 @@ export class AbiGenDummyContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`AbiGenDummy successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new AbiGenDummyContract(txReceipt.contractAddress as string, provider, txDefaults); + const contractInstance = new AbiGenDummyContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + abiDependencies, + ); contractInstance.constructorArgs = []; return contractInstance; } @@ -1538,8 +1552,13 @@ export class AbiGenDummyContract extends BaseContract { ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial) { - super('AbiGenDummy', AbiGenDummyContract.ABI(), address, supportedProvider, txDefaults); + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { + super('AbiGenDummy', AbiGenDummyContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( AbiGenDummyContract.ABI(), diff --git a/packages/abi-gen/test-cli/expected-output/typescript/lib_dummy.ts b/packages/abi-gen/test-cli/expected-output/typescript/lib_dummy.ts index f613fbb853..7f41b6deae 100644 --- a/packages/abi-gen/test-cli/expected-output/typescript/lib_dummy.ts +++ b/packages/abi-gen/test-cli/expected-output/typescript/lib_dummy.ts @@ -21,6 +21,7 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; +import * as _ from 'lodash'; // tslint:enable:no-unused-variable /* istanbul ignore next */ @@ -31,6 +32,7 @@ export class LibDummyContract extends BaseContract { artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, + artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -43,13 +45,20 @@ export class LibDummyContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - return LibDummyContract.deployAsync(bytecode, abi, provider, txDefaults); + const abiDependencies = _.mapValues( + artifactDependencies, + (artifactDependency: ContractArtifact | SimpleContractArtifact) => { + return artifactDependency.compilerOutput.abi; + }, + ); + return LibDummyContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, + abiDependencies: { [contractName: string]: ContractAbi }, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -73,7 +82,12 @@ export class LibDummyContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`LibDummy successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new LibDummyContract(txReceipt.contractAddress as string, provider, txDefaults); + const contractInstance = new LibDummyContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + abiDependencies, + ); contractInstance.constructorArgs = []; return contractInstance; } @@ -85,8 +99,13 @@ export class LibDummyContract extends BaseContract { const abi = [] as ContractAbi; return abi; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial) { - super('LibDummy', LibDummyContract.ABI(), address, supportedProvider, txDefaults); + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { + super('LibDummy', LibDummyContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); } } diff --git a/packages/abi-gen/test-cli/expected-output/typescript/test_lib_dummy.ts b/packages/abi-gen/test-cli/expected-output/typescript/test_lib_dummy.ts index 7c192214a1..364c78f740 100644 --- a/packages/abi-gen/test-cli/expected-output/typescript/test_lib_dummy.ts +++ b/packages/abi-gen/test-cli/expected-output/typescript/test_lib_dummy.ts @@ -21,6 +21,7 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; +import * as _ from 'lodash'; // tslint:enable:no-unused-variable /* istanbul ignore next */ @@ -111,6 +112,7 @@ export class TestLibDummyContract extends BaseContract { artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, + artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -123,13 +125,20 @@ export class TestLibDummyContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - return TestLibDummyContract.deployAsync(bytecode, abi, provider, txDefaults); + const abiDependencies = _.mapValues( + artifactDependencies, + (artifactDependency: ContractArtifact | SimpleContractArtifact) => { + return artifactDependency.compilerOutput.abi; + }, + ); + return TestLibDummyContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, + abiDependencies: { [contractName: string]: ContractAbi }, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -153,7 +162,12 @@ export class TestLibDummyContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`TestLibDummy successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new TestLibDummyContract(txReceipt.contractAddress as string, provider, txDefaults); + const contractInstance = new TestLibDummyContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + abiDependencies, + ); contractInstance.constructorArgs = []; return contractInstance; } @@ -204,8 +218,20 @@ export class TestLibDummyContract extends BaseContract { ] as ContractAbi; return abi; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial) { - super('TestLibDummy', TestLibDummyContract.ABI(), address, supportedProvider, txDefaults); + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { + super( + 'TestLibDummy', + TestLibDummyContract.ABI(), + address, + supportedProvider, + txDefaults, + logDecodeDependencies, + ); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); } } From 58e08335b5bdf25f569ce7527a419a051caebb91 Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Fri, 26 Jul 2019 20:33:30 +0200 Subject: [PATCH 08/15] Added another test to show what happens when decoding both local and downstream events --- .../utils/contracts/test/TestLogDecoding.sol | 8 ++++++++ contracts/utils/test/log_decoding.ts | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/contracts/utils/contracts/test/TestLogDecoding.sol b/contracts/utils/contracts/test/TestLogDecoding.sol index 145cebf143..e692d8b75f 100644 --- a/contracts/utils/contracts/test/TestLogDecoding.sol +++ b/contracts/utils/contracts/test/TestLogDecoding.sol @@ -44,4 +44,12 @@ contract TestLogDecoding { TestLogDecodingDownstream testLogDecodingDownstream = new TestLogDecodingDownstream(); ITestLogDecodingDownstream(testLogDecodingDownstream).emitEvent(); } + + /// @dev Emits a local event and a downstream event + function emitEventsLocalAndDownstream() + public + { + emitEvent(); + emitEventDownstream(); + } } \ No newline at end of file diff --git a/contracts/utils/test/log_decoding.ts b/contracts/utils/test/log_decoding.ts index 141731892a..16ae7a6244 100644 --- a/contracts/utils/test/log_decoding.ts +++ b/contracts/utils/test/log_decoding.ts @@ -55,9 +55,18 @@ describe('TestLogDecoding', () => { }); it('should not event args when no dependencies are passed into wrapper', async () => { const txReceipt = await testLogDecodingDeployedWithoutDependencies.emitEventDownstream.awaitTransactionSuccessAsync(); + expect(txReceipt.logs.length).to.be.equal(1); // tslint:disable no-unnecessary-type-assertion expect((txReceipt.logs[0] as LogWithDecodedArgs).args).to.be.undefined(); }); + it('should decode args for local but not downstream event when no dependencies are passed into wrapper', async () => { + const txReceipt = await testLogDecodingDeployedWithoutDependencies.emitEventsLocalAndDownstream.awaitTransactionSuccessAsync(); + expect(txReceipt.logs.length).to.be.equal(2); + // tslint:disable no-unnecessary-type-assertion + expect((txReceipt.logs[0] as LogWithDecodedArgs).args).to.be.deep.equal(expectedEvent); + // tslint:disable no-unnecessary-type-assertion + expect((txReceipt.logs[1] as LogWithDecodedArgs).args).to.be.undefined(); + }); it('should decode locally emitted event args when dependencies are passed into wrapper', async () => { const txReceipt = await testLogDecodingWithDependencies.emitEvent.awaitTransactionSuccessAsync(); expect(txReceipt.logs.length).to.be.equal(1); @@ -72,5 +81,15 @@ describe('TestLogDecoding', () => { expectedDownstreamEvent, ); }); + it('should decode args for both local and downstream events when dependencies are passed into wrapper', async () => { + const txReceipt = await testLogDecodingWithDependencies.emitEventsLocalAndDownstream.awaitTransactionSuccessAsync(); + expect(txReceipt.logs.length).to.be.equal(2); + // tslint:disable no-unnecessary-type-assertion + expect((txReceipt.logs[0] as LogWithDecodedArgs).args).to.be.deep.equal(expectedEvent); + // tslint:disable no-unnecessary-type-assertion + expect((txReceipt.logs[1] as LogWithDecodedArgs).args).to.be.deep.equal( + expectedDownstreamEvent, + ); + }); }); }); From 8961b476efc8448ac505d12250091c7de61fb985 Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Fri, 26 Jul 2019 20:51:40 +0200 Subject: [PATCH 09/15] fixed typo in a test --- contracts/utils/test/log_decoding.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/utils/test/log_decoding.ts b/contracts/utils/test/log_decoding.ts index 16ae7a6244..13d9d14971 100644 --- a/contracts/utils/test/log_decoding.ts +++ b/contracts/utils/test/log_decoding.ts @@ -53,7 +53,7 @@ describe('TestLogDecoding', () => { // tslint:disable no-unnecessary-type-assertion expect((txReceipt.logs[0] as LogWithDecodedArgs).args).to.be.deep.equal(expectedEvent); }); - it('should not event args when no dependencies are passed into wrapper', async () => { + it('should not decode event args when no dependencies are passed into wrapper', async () => { const txReceipt = await testLogDecodingDeployedWithoutDependencies.emitEventDownstream.awaitTransactionSuccessAsync(); expect(txReceipt.logs.length).to.be.equal(1); // tslint:disable no-unnecessary-type-assertion From c2f34baee079f95b28b9424510ffa5226e03ef31 Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Mon, 29 Jul 2019 12:02:13 +0200 Subject: [PATCH 10/15] Changed artifactDependencies/abiDependencies to logDecodeDependencies + removed lodash depency in contract wrappers --- .../abi-gen-templates/contract.handlebars | 11 ++++----- .../generated-wrappers/asset_proxy_owner.ts | 17 ++++++------- .../src/generated-wrappers/coordinator.ts | 24 +++++++++++-------- .../coordinator_registry.ts | 23 ++++++++++-------- .../generated-wrappers/dummy_erc20_token.ts | 17 ++++++------- .../generated-wrappers/dummy_erc721_token.ts | 17 ++++++------- .../src/generated-wrappers/dutch_auction.ts | 24 +++++++++++-------- .../src/generated-wrappers/erc20_proxy.ts | 17 ++++++------- .../src/generated-wrappers/erc20_token.ts | 17 ++++++------- .../src/generated-wrappers/erc721_proxy.ts | 17 ++++++------- .../src/generated-wrappers/erc721_token.ts | 17 ++++++------- .../generated-wrappers/eth_balance_checker.ts | 17 ++++++------- .../src/generated-wrappers/exchange.ts | 24 +++++++++++-------- .../src/generated-wrappers/forwarder.ts | 17 ++++++------- .../src/generated-wrappers/i_asset_proxy.ts | 17 ++++++------- .../src/generated-wrappers/i_validator.ts | 17 ++++++------- .../src/generated-wrappers/i_wallet.ts | 17 ++++++------- .../generated-wrappers/multi_asset_proxy.ts | 17 ++++++------- .../src/generated-wrappers/order_validator.ts | 17 ++++++------- .../src/generated-wrappers/weth9.ts | 17 ++++++------- .../src/generated-wrappers/zrx_token.ts | 17 ++++++------- packages/base-contract/src/index.ts | 13 +++++++--- 22 files changed, 182 insertions(+), 209 deletions(-) diff --git a/packages/abi-gen-templates/contract.handlebars b/packages/abi-gen-templates/contract.handlebars index 61375cb0a0..b9683d30f8 100644 --- a/packages/abi-gen-templates/contract.handlebars +++ b/packages/abi-gen-templates/contract.handlebars @@ -26,7 +26,6 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; -import * as _ from 'lodash'; // tslint:enable:no-unused-variable {{#if events}} @@ -64,7 +63,7 @@ export class {{contractName}}Contract extends BaseContract { artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, {{> typed_params inputs=ctor.inputs}} ): Promise<{{contractName}}Contract> { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -78,15 +77,15 @@ export class {{contractName}}Contract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues(artifactDependencies, (artifactDependency: ContractArtifact | SimpleContractArtifact) => {return artifactDependency.compilerOutput.abi}); - return {{contractName}}Contract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, {{> params inputs=ctor.inputs}}); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); + return {{contractName}}Contract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, {{> params inputs=ctor.inputs}}); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, - abiDependencies: { [contractName: string]: ContractAbi }, + logDecodeDependencies: { [contractName: string]: ContractAbi }, {{> typed_params inputs=ctor.inputs}} ): Promise<{{contractName}}Contract> { assert.isHexString('bytecode', bytecode); @@ -115,7 +114,7 @@ export class {{contractName}}Contract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`{{contractName}} successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new {{contractName}}Contract(txReceipt.contractAddress as string, provider, txDefaults, abiDependencies); + const contractInstance = new {{contractName}}Contract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); contractInstance.constructorArgs = [{{> params inputs=ctor.inputs}}]; return contractInstance; } 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 75c19b4e4f..d4f38be5c3 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 @@ -29,7 +29,6 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; -import * as _ from 'lodash'; // tslint:enable:no-unused-variable export type AssetProxyOwnerEventArgs = @@ -2097,7 +2096,7 @@ export class AssetProxyOwnerContract extends BaseContract { artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, _owners: string[], _assetProxyContracts: string[], _required: BigNumber, @@ -2114,18 +2113,16 @@ export class AssetProxyOwnerContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues( - artifactDependencies, - (artifactDependency: ContractArtifact | SimpleContractArtifact) => { - return artifactDependency.compilerOutput.abi; - }, + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, ); return AssetProxyOwnerContract.deployAsync( bytecode, abi, provider, txDefaults, - abiDependencies, + logDecodeDependenciesAbiOnly, _owners, _assetProxyContracts, _required, @@ -2137,7 +2134,7 @@ export class AssetProxyOwnerContract extends BaseContract { abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, - abiDependencies: { [contractName: string]: ContractAbi }, + logDecodeDependencies: { [contractName: string]: ContractAbi }, _owners: string[], _assetProxyContracts: string[], _required: BigNumber, @@ -2173,7 +2170,7 @@ export class AssetProxyOwnerContract extends BaseContract { txReceipt.contractAddress as string, provider, txDefaults, - abiDependencies, + logDecodeDependencies, ); contractInstance.constructorArgs = [_owners, _assetProxyContracts, _required, _secondsTimeLocked]; return contractInstance; diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts index 56f9d09e2b..305e0b38aa 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts @@ -21,7 +21,6 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; -import * as _ from 'lodash'; // tslint:enable:no-unused-variable /* istanbul ignore next */ @@ -616,7 +615,7 @@ export class CoordinatorContract extends BaseContract { artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, _exchange: string, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -630,20 +629,25 @@ export class CoordinatorContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues( - artifactDependencies, - (artifactDependency: ContractArtifact | SimpleContractArtifact) => { - return artifactDependency.compilerOutput.abi; - }, + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, + ); + return CoordinatorContract.deployAsync( + bytecode, + abi, + provider, + txDefaults, + logDecodeDependenciesAbiOnly, + _exchange, ); - return CoordinatorContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, _exchange); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, - abiDependencies: { [contractName: string]: ContractAbi }, + logDecodeDependencies: { [contractName: string]: ContractAbi }, _exchange: string, ): Promise { assert.isHexString('bytecode', bytecode); @@ -676,7 +680,7 @@ export class CoordinatorContract extends BaseContract { txReceipt.contractAddress as string, provider, txDefaults, - abiDependencies, + logDecodeDependencies, ); contractInstance.constructorArgs = [_exchange]; return contractInstance; 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 9f11a590c3..50ea62a44f 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts @@ -29,7 +29,6 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; -import * as _ from 'lodash'; // tslint:enable:no-unused-variable export type CoordinatorRegistryEventArgs = CoordinatorRegistryCoordinatorEndpointSetEventArgs; @@ -206,7 +205,7 @@ export class CoordinatorRegistryContract extends BaseContract { artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -219,20 +218,24 @@ export class CoordinatorRegistryContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues( - artifactDependencies, - (artifactDependency: ContractArtifact | SimpleContractArtifact) => { - return artifactDependency.compilerOutput.abi; - }, + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, + ); + return CoordinatorRegistryContract.deployAsync( + bytecode, + abi, + provider, + txDefaults, + logDecodeDependenciesAbiOnly, ); - return CoordinatorRegistryContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, - abiDependencies: { [contractName: string]: ContractAbi }, + logDecodeDependencies: { [contractName: string]: ContractAbi }, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -260,7 +263,7 @@ export class CoordinatorRegistryContract extends BaseContract { txReceipt.contractAddress as string, provider, txDefaults, - abiDependencies, + logDecodeDependencies, ); contractInstance.constructorArgs = []; return contractInstance; 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 573127280a..7947130b0d 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 @@ -29,7 +29,6 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; -import * as _ from 'lodash'; // tslint:enable:no-unused-variable export type DummyERC20TokenEventArgs = DummyERC20TokenTransferEventArgs | DummyERC20TokenApprovalEventArgs; @@ -1116,7 +1115,7 @@ export class DummyERC20TokenContract extends BaseContract { artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, _name: string, _symbol: string, _decimals: BigNumber, @@ -1133,18 +1132,16 @@ export class DummyERC20TokenContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues( - artifactDependencies, - (artifactDependency: ContractArtifact | SimpleContractArtifact) => { - return artifactDependency.compilerOutput.abi; - }, + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, ); return DummyERC20TokenContract.deployAsync( bytecode, abi, provider, txDefaults, - abiDependencies, + logDecodeDependenciesAbiOnly, _name, _symbol, _decimals, @@ -1156,7 +1153,7 @@ export class DummyERC20TokenContract extends BaseContract { abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, - abiDependencies: { [contractName: string]: ContractAbi }, + logDecodeDependencies: { [contractName: string]: ContractAbi }, _name: string, _symbol: string, _decimals: BigNumber, @@ -1192,7 +1189,7 @@ export class DummyERC20TokenContract extends BaseContract { txReceipt.contractAddress as string, provider, txDefaults, - abiDependencies, + logDecodeDependencies, ); contractInstance.constructorArgs = [_name, _symbol, _decimals, _totalSupply]; return contractInstance; 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 03ad59fe4e..c3ad0fed54 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 @@ -29,7 +29,6 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; -import * as _ from 'lodash'; // tslint:enable:no-unused-variable export type DummyERC721TokenEventArgs = @@ -1446,7 +1445,7 @@ export class DummyERC721TokenContract extends BaseContract { artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, _name: string, _symbol: string, ): Promise { @@ -1461,18 +1460,16 @@ export class DummyERC721TokenContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues( - artifactDependencies, - (artifactDependency: ContractArtifact | SimpleContractArtifact) => { - return artifactDependency.compilerOutput.abi; - }, + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, ); return DummyERC721TokenContract.deployAsync( bytecode, abi, provider, txDefaults, - abiDependencies, + logDecodeDependenciesAbiOnly, _name, _symbol, ); @@ -1482,7 +1479,7 @@ export class DummyERC721TokenContract extends BaseContract { abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, - abiDependencies: { [contractName: string]: ContractAbi }, + logDecodeDependencies: { [contractName: string]: ContractAbi }, _name: string, _symbol: string, ): Promise { @@ -1516,7 +1513,7 @@ export class DummyERC721TokenContract extends BaseContract { txReceipt.contractAddress as string, provider, txDefaults, - abiDependencies, + logDecodeDependencies, ); contractInstance.constructorArgs = [_name, _symbol]; return contractInstance; 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 1eaa590042..e7aa2434df 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts @@ -21,7 +21,6 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; -import * as _ from 'lodash'; // tslint:enable:no-unused-variable /* istanbul ignore next */ @@ -540,7 +539,7 @@ export class DutchAuctionContract extends BaseContract { artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, _exchange: string, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -554,20 +553,25 @@ export class DutchAuctionContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues( - artifactDependencies, - (artifactDependency: ContractArtifact | SimpleContractArtifact) => { - return artifactDependency.compilerOutput.abi; - }, + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, + ); + return DutchAuctionContract.deployAsync( + bytecode, + abi, + provider, + txDefaults, + logDecodeDependenciesAbiOnly, + _exchange, ); - return DutchAuctionContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, _exchange); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, - abiDependencies: { [contractName: string]: ContractAbi }, + logDecodeDependencies: { [contractName: string]: ContractAbi }, _exchange: string, ): Promise { assert.isHexString('bytecode', bytecode); @@ -600,7 +604,7 @@ export class DutchAuctionContract extends BaseContract { txReceipt.contractAddress as string, provider, txDefaults, - abiDependencies, + logDecodeDependencies, ); contractInstance.constructorArgs = [_exchange]; return contractInstance; 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 e3e1d9553a..bcfd2f5b1c 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts @@ -29,7 +29,6 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; -import * as _ from 'lodash'; // tslint:enable:no-unused-variable export type ERC20ProxyEventArgs = @@ -705,7 +704,7 @@ export class ERC20ProxyContract extends BaseContract { artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -718,20 +717,18 @@ export class ERC20ProxyContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues( - artifactDependencies, - (artifactDependency: ContractArtifact | SimpleContractArtifact) => { - return artifactDependency.compilerOutput.abi; - }, + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, ); - return ERC20ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies); + return ERC20ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, - abiDependencies: { [contractName: string]: ContractAbi }, + logDecodeDependencies: { [contractName: string]: ContractAbi }, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -759,7 +756,7 @@ export class ERC20ProxyContract extends BaseContract { txReceipt.contractAddress as string, provider, txDefaults, - abiDependencies, + logDecodeDependencies, ); contractInstance.constructorArgs = []; return contractInstance; 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 851bb18d4d..58b2815bc4 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts @@ -29,7 +29,6 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; -import * as _ from 'lodash'; // tslint:enable:no-unused-variable export type ERC20TokenEventArgs = ERC20TokenTransferEventArgs | ERC20TokenApprovalEventArgs; @@ -593,7 +592,7 @@ export class ERC20TokenContract extends BaseContract { artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -606,20 +605,18 @@ export class ERC20TokenContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues( - artifactDependencies, - (artifactDependency: ContractArtifact | SimpleContractArtifact) => { - return artifactDependency.compilerOutput.abi; - }, + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, ); - return ERC20TokenContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies); + return ERC20TokenContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, - abiDependencies: { [contractName: string]: ContractAbi }, + logDecodeDependencies: { [contractName: string]: ContractAbi }, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -647,7 +644,7 @@ export class ERC20TokenContract extends BaseContract { txReceipt.contractAddress as string, provider, txDefaults, - abiDependencies, + logDecodeDependencies, ); contractInstance.constructorArgs = []; return contractInstance; 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 4a5dd7c166..ee5085d4ab 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts @@ -29,7 +29,6 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; -import * as _ from 'lodash'; // tslint:enable:no-unused-variable export type ERC721ProxyEventArgs = @@ -705,7 +704,7 @@ export class ERC721ProxyContract extends BaseContract { artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -718,20 +717,18 @@ export class ERC721ProxyContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues( - artifactDependencies, - (artifactDependency: ContractArtifact | SimpleContractArtifact) => { - return artifactDependency.compilerOutput.abi; - }, + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, ); - return ERC721ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies); + return ERC721ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, - abiDependencies: { [contractName: string]: ContractAbi }, + logDecodeDependencies: { [contractName: string]: ContractAbi }, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -759,7 +756,7 @@ export class ERC721ProxyContract extends BaseContract { txReceipt.contractAddress as string, provider, txDefaults, - abiDependencies, + logDecodeDependencies, ); contractInstance.constructorArgs = []; return contractInstance; 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 081cfcad87..2a0420e010 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts @@ -29,7 +29,6 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; -import * as _ from 'lodash'; // tslint:enable:no-unused-variable export type ERC721TokenEventArgs = @@ -986,7 +985,7 @@ export class ERC721TokenContract extends BaseContract { artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -999,20 +998,18 @@ export class ERC721TokenContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues( - artifactDependencies, - (artifactDependency: ContractArtifact | SimpleContractArtifact) => { - return artifactDependency.compilerOutput.abi; - }, + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, ); - return ERC721TokenContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies); + return ERC721TokenContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, - abiDependencies: { [contractName: string]: ContractAbi }, + logDecodeDependencies: { [contractName: string]: ContractAbi }, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -1040,7 +1037,7 @@ export class ERC721TokenContract extends BaseContract { txReceipt.contractAddress as string, provider, txDefaults, - abiDependencies, + logDecodeDependencies, ); contractInstance.constructorArgs = []; return contractInstance; 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 fd6b09065b..e4a6c2ac39 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 @@ -21,7 +21,6 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; -import * as _ from 'lodash'; // tslint:enable:no-unused-variable /* istanbul ignore next */ @@ -76,7 +75,7 @@ export class EthBalanceCheckerContract extends BaseContract { artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -89,20 +88,18 @@ export class EthBalanceCheckerContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues( - artifactDependencies, - (artifactDependency: ContractArtifact | SimpleContractArtifact) => { - return artifactDependency.compilerOutput.abi; - }, + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, ); - return EthBalanceCheckerContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies); + return EthBalanceCheckerContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, - abiDependencies: { [contractName: string]: ContractAbi }, + logDecodeDependencies: { [contractName: string]: ContractAbi }, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -130,7 +127,7 @@ export class EthBalanceCheckerContract extends BaseContract { txReceipt.contractAddress as string, provider, txDefaults, - abiDependencies, + logDecodeDependencies, ); contractInstance.constructorArgs = []; return contractInstance; diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts index ca14974c8f..873bde5b79 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts @@ -29,7 +29,6 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; -import * as _ from 'lodash'; // tslint:enable:no-unused-variable export type ExchangeEventArgs = @@ -4569,7 +4568,7 @@ export class ExchangeContract extends BaseContract { artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, _zrxAssetData: string, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -4583,20 +4582,25 @@ export class ExchangeContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues( - artifactDependencies, - (artifactDependency: ContractArtifact | SimpleContractArtifact) => { - return artifactDependency.compilerOutput.abi; - }, + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, + ); + return ExchangeContract.deployAsync( + bytecode, + abi, + provider, + txDefaults, + logDecodeDependenciesAbiOnly, + _zrxAssetData, ); - return ExchangeContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies, _zrxAssetData); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, - abiDependencies: { [contractName: string]: ContractAbi }, + logDecodeDependencies: { [contractName: string]: ContractAbi }, _zrxAssetData: string, ): Promise { assert.isHexString('bytecode', bytecode); @@ -4629,7 +4633,7 @@ export class ExchangeContract extends BaseContract { txReceipt.contractAddress as string, provider, txDefaults, - abiDependencies, + logDecodeDependencies, ); contractInstance.constructorArgs = [_zrxAssetData]; return contractInstance; diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts b/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts index 516d23f1c6..4a4e7f68ef 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts @@ -21,7 +21,6 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; -import * as _ from 'lodash'; // tslint:enable:no-unused-variable /* istanbul ignore next */ @@ -1042,7 +1041,7 @@ export class ForwarderContract extends BaseContract { artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, _exchange: string, _zrxAssetData: string, _wethAssetData: string, @@ -1058,18 +1057,16 @@ export class ForwarderContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues( - artifactDependencies, - (artifactDependency: ContractArtifact | SimpleContractArtifact) => { - return artifactDependency.compilerOutput.abi; - }, + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, ); return ForwarderContract.deployAsync( bytecode, abi, provider, txDefaults, - abiDependencies, + logDecodeDependenciesAbiOnly, _exchange, _zrxAssetData, _wethAssetData, @@ -1080,7 +1077,7 @@ export class ForwarderContract extends BaseContract { abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, - abiDependencies: { [contractName: string]: ContractAbi }, + logDecodeDependencies: { [contractName: string]: ContractAbi }, _exchange: string, _zrxAssetData: string, _wethAssetData: string, @@ -1115,7 +1112,7 @@ export class ForwarderContract extends BaseContract { txReceipt.contractAddress as string, provider, txDefaults, - abiDependencies, + logDecodeDependencies, ); contractInstance.constructorArgs = [_exchange, _zrxAssetData, _wethAssetData]; return contractInstance; 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 c2bceb318a..13b92cc118 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 @@ -21,7 +21,6 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; -import * as _ from 'lodash'; // tslint:enable:no-unused-variable /* istanbul ignore next */ @@ -710,7 +709,7 @@ export class IAssetProxyContract extends BaseContract { artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -723,20 +722,18 @@ export class IAssetProxyContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues( - artifactDependencies, - (artifactDependency: ContractArtifact | SimpleContractArtifact) => { - return artifactDependency.compilerOutput.abi; - }, + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, ); - return IAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies); + return IAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, - abiDependencies: { [contractName: string]: ContractAbi }, + logDecodeDependencies: { [contractName: string]: ContractAbi }, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -764,7 +761,7 @@ export class IAssetProxyContract extends BaseContract { txReceipt.contractAddress as string, provider, txDefaults, - abiDependencies, + logDecodeDependencies, ); contractInstance.constructorArgs = []; return contractInstance; 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 6c292e4867..fd016262d4 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts @@ -21,7 +21,6 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; -import * as _ from 'lodash'; // tslint:enable:no-unused-variable /* istanbul ignore next */ @@ -90,7 +89,7 @@ export class IValidatorContract extends BaseContract { artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -103,20 +102,18 @@ export class IValidatorContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues( - artifactDependencies, - (artifactDependency: ContractArtifact | SimpleContractArtifact) => { - return artifactDependency.compilerOutput.abi; - }, + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, ); - return IValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies); + return IValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, - abiDependencies: { [contractName: string]: ContractAbi }, + logDecodeDependencies: { [contractName: string]: ContractAbi }, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -144,7 +141,7 @@ export class IValidatorContract extends BaseContract { txReceipt.contractAddress as string, provider, txDefaults, - abiDependencies, + logDecodeDependencies, ); contractInstance.constructorArgs = []; return contractInstance; 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 6b143c8ee8..20a8250ba8 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts @@ -21,7 +21,6 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; -import * as _ from 'lodash'; // tslint:enable:no-unused-variable /* istanbul ignore next */ @@ -82,7 +81,7 @@ export class IWalletContract extends BaseContract { artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -95,20 +94,18 @@ export class IWalletContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues( - artifactDependencies, - (artifactDependency: ContractArtifact | SimpleContractArtifact) => { - return artifactDependency.compilerOutput.abi; - }, + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, ); - return IWalletContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies); + return IWalletContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, - abiDependencies: { [contractName: string]: ContractAbi }, + logDecodeDependencies: { [contractName: string]: ContractAbi }, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -136,7 +133,7 @@ export class IWalletContract extends BaseContract { txReceipt.contractAddress as string, provider, txDefaults, - abiDependencies, + logDecodeDependencies, ); contractInstance.constructorArgs = []; return contractInstance; 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 1449af3601..92628c0c03 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 @@ -29,7 +29,6 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; -import * as _ from 'lodash'; // tslint:enable:no-unused-variable export type MultiAssetProxyEventArgs = @@ -902,7 +901,7 @@ export class MultiAssetProxyContract extends BaseContract { artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -915,20 +914,18 @@ export class MultiAssetProxyContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues( - artifactDependencies, - (artifactDependency: ContractArtifact | SimpleContractArtifact) => { - return artifactDependency.compilerOutput.abi; - }, + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, ); - return MultiAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies); + return MultiAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, - abiDependencies: { [contractName: string]: ContractAbi }, + logDecodeDependencies: { [contractName: string]: ContractAbi }, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -956,7 +953,7 @@ export class MultiAssetProxyContract extends BaseContract { txReceipt.contractAddress as string, provider, txDefaults, - abiDependencies, + logDecodeDependencies, ); contractInstance.constructorArgs = []; return contractInstance; 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 a95b204c20..2183ee494f 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts @@ -21,7 +21,6 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; -import * as _ from 'lodash'; // tslint:enable:no-unused-variable /* istanbul ignore next */ @@ -619,7 +618,7 @@ export class OrderValidatorContract extends BaseContract { artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, _exchange: string, _zrxAssetData: string, ): Promise { @@ -634,18 +633,16 @@ export class OrderValidatorContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues( - artifactDependencies, - (artifactDependency: ContractArtifact | SimpleContractArtifact) => { - return artifactDependency.compilerOutput.abi; - }, + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, ); return OrderValidatorContract.deployAsync( bytecode, abi, provider, txDefaults, - abiDependencies, + logDecodeDependenciesAbiOnly, _exchange, _zrxAssetData, ); @@ -655,7 +652,7 @@ export class OrderValidatorContract extends BaseContract { abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, - abiDependencies: { [contractName: string]: ContractAbi }, + logDecodeDependencies: { [contractName: string]: ContractAbi }, _exchange: string, _zrxAssetData: string, ): Promise { @@ -689,7 +686,7 @@ export class OrderValidatorContract extends BaseContract { txReceipt.contractAddress as string, provider, txDefaults, - abiDependencies, + logDecodeDependencies, ); contractInstance.constructorArgs = [_exchange, _zrxAssetData]; return contractInstance; diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts b/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts index c7db77be2c..fdf60d3ea7 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts @@ -29,7 +29,6 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; -import * as _ from 'lodash'; // tslint:enable:no-unused-variable export type WETH9EventArgs = @@ -898,7 +897,7 @@ export class WETH9Contract extends BaseContract { artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -911,20 +910,18 @@ export class WETH9Contract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues( - artifactDependencies, - (artifactDependency: ContractArtifact | SimpleContractArtifact) => { - return artifactDependency.compilerOutput.abi; - }, + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, ); - return WETH9Contract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies); + return WETH9Contract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, - abiDependencies: { [contractName: string]: ContractAbi }, + logDecodeDependencies: { [contractName: string]: ContractAbi }, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -952,7 +949,7 @@ export class WETH9Contract extends BaseContract { txReceipt.contractAddress as string, provider, txDefaults, - abiDependencies, + logDecodeDependencies, ); contractInstance.constructorArgs = []; return contractInstance; 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 ceaad03979..d980c02253 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts @@ -29,7 +29,6 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; -import * as _ from 'lodash'; // tslint:enable:no-unused-variable export type ZRXTokenEventArgs = ZRXTokenTransferEventArgs | ZRXTokenApprovalEventArgs; @@ -707,7 +706,7 @@ export class ZRXTokenContract extends BaseContract { artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -720,20 +719,18 @@ export class ZRXTokenContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues( - artifactDependencies, - (artifactDependency: ContractArtifact | SimpleContractArtifact) => { - return artifactDependency.compilerOutput.abi; - }, + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, ); - return ZRXTokenContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies); + return ZRXTokenContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, - abiDependencies: { [contractName: string]: ContractAbi }, + logDecodeDependencies: { [contractName: string]: ContractAbi }, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -761,7 +758,7 @@ export class ZRXTokenContract extends BaseContract { txReceipt.contractAddress as string, provider, txDefaults, - abiDependencies, + logDecodeDependencies, ); contractInstance.constructorArgs = []; return contractInstance; diff --git a/packages/base-contract/src/index.ts b/packages/base-contract/src/index.ts index 09287a00c1..dddf5a2dcd 100644 --- a/packages/base-contract/src/index.ts +++ b/packages/base-contract/src/index.ts @@ -180,13 +180,20 @@ export class BaseContract { const abiEncodedArguments = abiEncoder.encode(functionArguments); return abiEncodedArguments; } + /// @dev Constructs a contract wrapper. + /// @param contractName Name of contract. + /// @param abi of the contract. + /// @param address of the deployed contract. + /// @param supportedProvider for communicating with an ethereum node. + /// @param logDecodeDependencies the name and ABI of contracts whose event logs are + /// decoded by this wrapper. constructor( contractName: string, abi: ContractAbi, address: string, supportedProvider: SupportedProvider, callAndTxnDefaults?: Partial, - abiDependencies?: { [contractName: string]: ContractAbi }, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, ) { assert.isString('contractName', contractName); assert.isETHAddressHex('address', address); @@ -212,8 +219,8 @@ export class BaseContract { this._abiEncoderByFunctionSignature[functionSignature] = abiEncoder; this._web3Wrapper.abiDecoder.addABI(abi, contractName); }); - _.each(abiDependencies, (abiDependency, contractDependencyName) => { - this._web3Wrapper.abiDecoder.addABI(abiDependency, contractDependencyName); + _.each(logDecodeDependencies, (dependencyAbi, dependencyName) => { + this._web3Wrapper.abiDecoder.addABI(dependencyAbi, dependencyName); }); } } From 048e48b03aa8e31244942e732fcfcb0644f27f60 Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Mon, 29 Jul 2019 12:24:19 +0200 Subject: [PATCH 11/15] updated contract wrappers --- .../generated-wrappers/asset_proxy_owner.ts | 2365 ++++---- .../src/generated-wrappers/coordinator.ts | 628 +- .../coordinator_registry.ts | 256 +- .../generated-wrappers/dummy_erc20_token.ts | 1299 +++-- .../generated-wrappers/dummy_erc721_token.ts | 1646 +++--- .../src/generated-wrappers/dutch_auction.ts | 691 +-- .../src/generated-wrappers/erc20_proxy.ts | 820 +-- .../src/generated-wrappers/erc20_token.ts | 642 +- .../src/generated-wrappers/erc721_proxy.ts | 820 +-- .../src/generated-wrappers/erc721_token.ts | 1066 ++-- .../generated-wrappers/eth_balance_checker.ts | 76 +- .../src/generated-wrappers/exchange.ts | 5196 +++++++---------- .../src/generated-wrappers/forwarder.ts | 1305 ++--- .../src/generated-wrappers/i_asset_proxy.ts | 904 +-- .../src/generated-wrappers/i_validator.ts | 81 +- .../src/generated-wrappers/i_wallet.ts | 73 +- .../generated-wrappers/multi_asset_proxy.ts | 1041 ++-- .../src/generated-wrappers/order_validator.ts | 586 +- .../src/generated-wrappers/weth9.ts | 1027 ++-- .../src/generated-wrappers/zrx_token.ts | 731 +-- 20 files changed, 10176 insertions(+), 11077 deletions(-) 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 d4f38be5c3..db528702d2 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 @@ -1,14 +1,11 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { - BaseContract, +import { BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager, - PromiseWithTransactionHash, -} from '@0x/base-contract'; + SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -113,6 +110,7 @@ export interface AssetProxyOwnerRequirementChangeEventArgs extends DecodedLogArg required: BigNumber; } + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name @@ -122,7 +120,8 @@ export class AssetProxyOwnerContract extends BaseContract { index_0: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -132,8 +131,9 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('owners(uint256)', [index_0]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('owners(uint256)', [index_0 + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -142,45 +142,54 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owners(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: BigNumber): string { + getABIEncodedTransactionData( + index_0: BigNumber, + ): string { assert.isBigNumber('index_0', index_0); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('owners(uint256)', [index_0]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('owners(uint256)', [index_0 + ]); return abiEncodedTransactionData; }, }; public removeOwner = { - async sendTransactionAsync(owner: string, txData?: Partial | undefined): Promise { - assert.isString('owner', owner); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeOwner.estimateGasAsync.bind(self, owner.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + owner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('owner', owner); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeOwner.estimateGasAsync.bind( + self, + owner.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( owner: string, @@ -188,41 +197,51 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('owner', owner); - const self = (this as any) as AssetProxyOwnerContract; - const txHashPromise = self.removeOwner.sendTransactionAsync(owner.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('owner', owner); + const self = this as any as AssetProxyOwnerContract; + const txHashPromise = self.removeOwner.sendTransactionAsync(owner.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(owner: string, txData?: Partial | undefined): Promise { - assert.isString('owner', owner); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + owner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('owner', owner); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(owner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + owner: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('owner', owner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -232,8 +251,9 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner.toLowerCase()]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -242,47 +262,54 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeOwner(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(owner: string): string { + getABIEncodedTransactionData( + owner: string, + ): string { assert.isString('owner', owner); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeOwner(address)', [ - owner.toLowerCase(), - ]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeOwner(address)', [owner.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public revokeConfirmation = { - async sendTransactionAsync(transactionId: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.revokeConfirmation.estimateGasAsync.bind(self, transactionId), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + transactionId: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('transactionId', transactionId); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.revokeConfirmation.estimateGasAsync.bind( + self, + transactionId + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( transactionId: BigNumber, @@ -290,45 +317,51 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const txHashPromise = self.revokeConfirmation.sendTransactionAsync(transactionId, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('transactionId', transactionId); + const self = this as any as AssetProxyOwnerContract; + const txHashPromise = self.revokeConfirmation.sendTransactionAsync(transactionId + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(transactionId: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + transactionId: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('transactionId', transactionId); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( transactionId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('transactionId', transactionId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -338,8 +371,9 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -348,24 +382,24 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('revokeConfirmation(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(transactionId: BigNumber): string { + getABIEncodedTransactionData( + transactionId: BigNumber, + ): string { assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('revokeConfirmation(uint256)', [ - transactionId, - ]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId + ]); return abiEncodedTransactionData; }, }; @@ -374,7 +408,8 @@ export class AssetProxyOwnerContract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -384,8 +419,9 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('isOwner(address)', [index_0.toLowerCase()]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('isOwner(address)', [index_0.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -394,22 +430,24 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isOwner(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: string): string { + getABIEncodedTransactionData( + index_0: string, + ): string { assert.isString('index_0', index_0); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('isOwner(address)', [index_0.toLowerCase()]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isOwner(address)', [index_0.toLowerCase() + ]); return abiEncodedTransactionData; }, }; @@ -419,7 +457,8 @@ export class AssetProxyOwnerContract extends BaseContract { index_1: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('index_0', index_0); assert.isString('index_1', index_1); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -430,11 +469,10 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('confirmations(uint256,address)', [ - index_0, - index_1.toLowerCase(), - ]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('confirmations(uint256,address)', [index_0, + index_1.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -443,51 +481,57 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('confirmations(uint256,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: BigNumber, index_1: string): string { + getABIEncodedTransactionData( + index_0: BigNumber, + index_1: string, + ): string { assert.isBigNumber('index_0', index_0); assert.isString('index_1', index_1); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('confirmations(uint256,address)', [ - index_0, - index_1.toLowerCase(), - ]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('confirmations(uint256,address)', [index_0, + index_1.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public executeRemoveAuthorizedAddressAtIndex = { - async sendTransactionAsync(transactionId: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [ - transactionId, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.executeRemoveAuthorizedAddressAtIndex.estimateGasAsync.bind(self, transactionId), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + transactionId: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('transactionId', transactionId); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [transactionId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.executeRemoveAuthorizedAddressAtIndex.estimateGasAsync.bind( + self, + transactionId + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( transactionId: BigNumber, @@ -495,50 +539,51 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const txHashPromise = self.executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync( - transactionId, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('transactionId', transactionId); + const self = this as any as AssetProxyOwnerContract; + const txHashPromise = self.executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(transactionId + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(transactionId: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [ - transactionId, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + transactionId: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('transactionId', transactionId); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [transactionId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( transactionId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('transactionId', transactionId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -548,10 +593,9 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [ - transactionId, - ]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [transactionId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -560,30 +604,33 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('executeRemoveAuthorizedAddressAtIndex(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(transactionId: BigNumber): string { + getABIEncodedTransactionData( + transactionId: BigNumber, + ): string { assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'executeRemoveAuthorizedAddressAtIndex(uint256)', - [transactionId], - ); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [transactionId + ]); return abiEncodedTransactionData; }, }; public secondsTimeLocked = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -592,7 +639,7 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; + const self = this as any as AssetProxyOwnerContract; const encodedData = self._strictEncodeArguments('secondsTimeLocked()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -602,20 +649,20 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('secondsTimeLocked()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as AssetProxyOwnerContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as AssetProxyOwnerContract; const abiEncodedTransactionData = self._strictEncodeArguments('secondsTimeLocked()', []); return abiEncodedTransactionData; }, @@ -626,7 +673,8 @@ export class AssetProxyOwnerContract extends BaseContract { executed: boolean, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBoolean('pending', pending); assert.isBoolean('executed', executed); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -637,8 +685,10 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('getTransactionCount(bool,bool)', [pending, executed]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('getTransactionCount(bool,bool)', [pending, + executed + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -647,26 +697,27 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getTransactionCount(bool,bool)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(pending: boolean, executed: boolean): string { + getABIEncodedTransactionData( + pending: boolean, + executed: boolean, + ): string { assert.isBoolean('pending', pending); assert.isBoolean('executed', executed); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getTransactionCount(bool,bool)', [ - pending, - executed, - ]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getTransactionCount(bool,bool)', [pending, + executed + ]); return abiEncodedTransactionData; }, }; @@ -674,30 +725,33 @@ export class AssetProxyOwnerContract extends BaseContract { async sendTransactionAsync( assetProxyContract: string, isRegistered: boolean, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('assetProxyContract', assetProxyContract); - assert.isBoolean('isRegistered', isRegistered); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [ + assert.isString('assetProxyContract', assetProxyContract); + assert.isBoolean('isRegistered', isRegistered); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [assetProxyContract.toLowerCase(), + isRegistered + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.registerAssetProxy.estimateGasAsync.bind( + self, assetProxyContract.toLowerCase(), - isRegistered, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.registerAssetProxy.estimateGasAsync.bind(self, assetProxyContract.toLowerCase(), isRegistered), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + isRegistered + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( assetProxyContract: string, @@ -706,59 +760,57 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('assetProxyContract', assetProxyContract); - assert.isBoolean('isRegistered', isRegistered); - const self = (this as any) as AssetProxyOwnerContract; - const txHashPromise = self.registerAssetProxy.sendTransactionAsync( - assetProxyContract.toLowerCase(), - isRegistered, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('assetProxyContract', assetProxyContract); + assert.isBoolean('isRegistered', isRegistered); + const self = this as any as AssetProxyOwnerContract; + const txHashPromise = self.registerAssetProxy.sendTransactionAsync(assetProxyContract.toLowerCase(), + isRegistered + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( assetProxyContract: string, isRegistered: boolean, txData?: Partial | undefined, ): Promise { - assert.isString('assetProxyContract', assetProxyContract); - assert.isBoolean('isRegistered', isRegistered); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [ - assetProxyContract.toLowerCase(), - isRegistered, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('assetProxyContract', assetProxyContract); + assert.isBoolean('isRegistered', isRegistered); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [assetProxyContract.toLowerCase(), + isRegistered + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( assetProxyContract: string, isRegistered: boolean, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('assetProxyContract', assetProxyContract); assert.isBoolean('isRegistered', isRegistered); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -769,11 +821,10 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [ - assetProxyContract.toLowerCase(), - isRegistered, - ]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [assetProxyContract.toLowerCase(), + isRegistered + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -782,49 +833,57 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address,bool)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(assetProxyContract: string, isRegistered: boolean): string { + getABIEncodedTransactionData( + assetProxyContract: string, + isRegistered: boolean, + ): string { assert.isString('assetProxyContract', assetProxyContract); assert.isBoolean('isRegistered', isRegistered); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [ - assetProxyContract.toLowerCase(), - isRegistered, - ]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [assetProxyContract.toLowerCase(), + isRegistered + ]); return abiEncodedTransactionData; }, }; public addOwner = { - async sendTransactionAsync(owner: string, txData?: Partial | undefined): Promise { - assert.isString('owner', owner); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.addOwner.estimateGasAsync.bind(self, owner.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + owner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('owner', owner); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.addOwner.estimateGasAsync.bind( + self, + owner.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( owner: string, @@ -832,41 +891,51 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('owner', owner); - const self = (this as any) as AssetProxyOwnerContract; - const txHashPromise = self.addOwner.sendTransactionAsync(owner.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('owner', owner); + const self = this as any as AssetProxyOwnerContract; + const txHashPromise = self.addOwner.sendTransactionAsync(owner.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(owner: string, txData?: Partial | undefined): Promise { - assert.isString('owner', owner); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + owner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('owner', owner); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(owner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + owner: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('owner', owner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -876,8 +945,9 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase()]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -886,22 +956,24 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('addOwner(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(owner: string): string { + getABIEncodedTransactionData( + owner: string, + ): string { assert.isString('owner', owner); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase()]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase() + ]); return abiEncodedTransactionData; }, }; @@ -910,7 +982,8 @@ export class AssetProxyOwnerContract extends BaseContract { transactionId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('transactionId', transactionId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -920,8 +993,9 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('isConfirmed(uint256)', [transactionId]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('isConfirmed(uint256)', [transactionId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -930,48 +1004,54 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isConfirmed(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(transactionId: BigNumber): string { + getABIEncodedTransactionData( + transactionId: BigNumber, + ): string { assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('isConfirmed(uint256)', [transactionId]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isConfirmed(uint256)', [transactionId + ]); return abiEncodedTransactionData; }, }; public changeTimeLock = { async sendTransactionAsync( _secondsTimeLocked: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.changeTimeLock.estimateGasAsync.bind(self, _secondsTimeLocked), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.changeTimeLock.estimateGasAsync.bind( + self, + _secondsTimeLocked + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _secondsTimeLocked: BigNumber, @@ -979,45 +1059,51 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); - const self = (this as any) as AssetProxyOwnerContract; - const txHashPromise = self.changeTimeLock.sendTransactionAsync(_secondsTimeLocked, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); + const self = this as any as AssetProxyOwnerContract; + const txHashPromise = self.changeTimeLock.sendTransactionAsync(_secondsTimeLocked + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(_secondsTimeLocked: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + _secondsTimeLocked: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _secondsTimeLocked: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1027,8 +1113,9 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1037,24 +1124,24 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('changeTimeLock(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_secondsTimeLocked: BigNumber): string { + getABIEncodedTransactionData( + _secondsTimeLocked: BigNumber, + ): string { assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('changeTimeLock(uint256)', [ - _secondsTimeLocked, - ]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked + ]); return abiEncodedTransactionData; }, }; @@ -1063,7 +1150,8 @@ export class AssetProxyOwnerContract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1073,8 +1161,9 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('isAssetProxyRegistered(address)', [index_0.toLowerCase()]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('isAssetProxyRegistered(address)', [index_0.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1083,24 +1172,24 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isAssetProxyRegistered(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: string): string { + getABIEncodedTransactionData( + index_0: string, + ): string { assert.isString('index_0', index_0); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('isAssetProxyRegistered(address)', [ - index_0.toLowerCase(), - ]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isAssetProxyRegistered(address)', [index_0.toLowerCase() + ]); return abiEncodedTransactionData; }, }; @@ -1109,7 +1198,8 @@ export class AssetProxyOwnerContract extends BaseContract { transactionId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('transactionId', transactionId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1119,8 +1209,9 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('getConfirmationCount(uint256)', [transactionId]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('getConfirmationCount(uint256)', [transactionId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1129,24 +1220,24 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getConfirmationCount(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(transactionId: BigNumber): string { + getABIEncodedTransactionData( + transactionId: BigNumber, + ): string { assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getConfirmationCount(uint256)', [ - transactionId, - ]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getConfirmationCount(uint256)', [transactionId + ]); return abiEncodedTransactionData; }, }; @@ -1155,7 +1246,8 @@ export class AssetProxyOwnerContract extends BaseContract { index_0: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<[string, BigNumber, string, boolean]> { + ): Promise<[string, BigNumber, string, boolean] + > { assert.isBigNumber('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1165,8 +1257,9 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('transactions(uint256)', [index_0]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('transactions(uint256)', [index_0 + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1175,27 +1268,33 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transactions(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<[string, BigNumber, string, boolean]>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<[string, BigNumber, string, boolean] + >(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: BigNumber): string { + getABIEncodedTransactionData( + index_0: BigNumber, + ): string { assert.isBigNumber('index_0', index_0); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transactions(uint256)', [index_0]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transactions(uint256)', [index_0 + ]); return abiEncodedTransactionData; }, }; public getOwners = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -1204,7 +1303,7 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; + const self = this as any as AssetProxyOwnerContract; const encodedData = self._strictEncodeArguments('getOwners()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1214,20 +1313,20 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getOwners()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as AssetProxyOwnerContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as AssetProxyOwnerContract; const abiEncodedTransactionData = self._strictEncodeArguments('getOwners()', []); return abiEncodedTransactionData; }, @@ -1240,7 +1339,8 @@ export class AssetProxyOwnerContract extends BaseContract { executed: boolean, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('from', from); assert.isBigNumber('to', to); assert.isBoolean('pending', pending); @@ -1253,13 +1353,12 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('getTransactionIds(uint256,uint256,bool,bool)', [ - from, - to, - pending, - executed, - ]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('getTransactionIds(uint256,uint256,bool,bool)', [from, + to, + pending, + executed + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1268,28 +1367,33 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getTransactionIds(uint256,uint256,bool,bool)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(from: BigNumber, to: BigNumber, pending: boolean, executed: boolean): string { + getABIEncodedTransactionData( + from: BigNumber, + to: BigNumber, + pending: boolean, + executed: boolean, + ): string { assert.isBigNumber('from', from); assert.isBigNumber('to', to); assert.isBoolean('pending', pending); assert.isBoolean('executed', executed); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'getTransactionIds(uint256,uint256,bool,bool)', - [from, to, pending, executed], - ); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getTransactionIds(uint256,uint256,bool,bool)', [from, + to, + pending, + executed + ]); return abiEncodedTransactionData; }, }; @@ -1298,7 +1402,8 @@ export class AssetProxyOwnerContract extends BaseContract { transactionId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('transactionId', transactionId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1308,8 +1413,9 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('getConfirmations(uint256)', [transactionId]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('getConfirmations(uint256)', [transactionId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1318,27 +1424,33 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getConfirmations(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(transactionId: BigNumber): string { + getABIEncodedTransactionData( + transactionId: BigNumber, + ): string { assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getConfirmations(uint256)', [transactionId]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getConfirmations(uint256)', [transactionId + ]); return abiEncodedTransactionData; }, }; public transactionCount = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -1347,7 +1459,7 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; + const self = this as any as AssetProxyOwnerContract; const encodedData = self._strictEncodeArguments('transactionCount()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1357,44 +1469,51 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transactionCount()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as AssetProxyOwnerContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as AssetProxyOwnerContract; const abiEncodedTransactionData = self._strictEncodeArguments('transactionCount()', []); return abiEncodedTransactionData; }, }; public changeRequirement = { - async sendTransactionAsync(_required: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('_required', _required); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('changeRequirement(uint256)', [_required]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.changeRequirement.estimateGasAsync.bind(self, _required), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + _required: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('_required', _required); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('changeRequirement(uint256)', [_required + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.changeRequirement.estimateGasAsync.bind( + self, + _required + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _required: BigNumber, @@ -1402,45 +1521,51 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('_required', _required); - const self = (this as any) as AssetProxyOwnerContract; - const txHashPromise = self.changeRequirement.sendTransactionAsync(_required, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('_required', _required); + const self = this as any as AssetProxyOwnerContract; + const txHashPromise = self.changeRequirement.sendTransactionAsync(_required + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(_required: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('_required', _required); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('changeRequirement(uint256)', [_required]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + _required: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('_required', _required); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('changeRequirement(uint256)', [_required + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _required: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('_required', _required); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1450,8 +1575,9 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('changeRequirement(uint256)', [_required]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('changeRequirement(uint256)', [_required + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1460,45 +1586,54 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('changeRequirement(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_required: BigNumber): string { + getABIEncodedTransactionData( + _required: BigNumber, + ): string { assert.isBigNumber('_required', _required); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('changeRequirement(uint256)', [_required]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('changeRequirement(uint256)', [_required + ]); return abiEncodedTransactionData; }, }; public confirmTransaction = { - async sendTransactionAsync(transactionId: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.confirmTransaction.estimateGasAsync.bind(self, transactionId), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + transactionId: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('transactionId', transactionId); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.confirmTransaction.estimateGasAsync.bind( + self, + transactionId + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( transactionId: BigNumber, @@ -1506,45 +1641,51 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const txHashPromise = self.confirmTransaction.sendTransactionAsync(transactionId, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('transactionId', transactionId); + const self = this as any as AssetProxyOwnerContract; + const txHashPromise = self.confirmTransaction.sendTransactionAsync(transactionId + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(transactionId: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + transactionId: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('transactionId', transactionId); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( transactionId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('transactionId', transactionId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1554,8 +1695,9 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1564,24 +1706,24 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('confirmTransaction(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(transactionId: BigNumber): string { + getABIEncodedTransactionData( + transactionId: BigNumber, + ): string { assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('confirmTransaction(uint256)', [ - transactionId, - ]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId + ]); return abiEncodedTransactionData; }, }; @@ -1590,62 +1732,64 @@ export class AssetProxyOwnerContract extends BaseContract { destination: string, value: BigNumber, data: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('destination', destination); - assert.isBigNumber('value', value); - assert.isString('data', data); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [ + assert.isString('destination', destination); + assert.isBigNumber('value', value); + assert.isString('data', data); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [destination.toLowerCase(), + value, + data + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.submitTransaction.estimateGasAsync.bind( + self, destination.toLowerCase(), value, - data, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.submitTransaction.estimateGasAsync.bind(self, destination.toLowerCase(), value, data), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + data + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( destination: string, - value: BigNumber, - data: string, - txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, - ): PromiseWithTransactionHash { - assert.isString('destination', destination); - assert.isBigNumber('value', value); - assert.isString('data', data); - const self = (this as any) as AssetProxyOwnerContract; - const txHashPromise = self.submitTransaction.sendTransactionAsync( - destination.toLowerCase(), - value, - data, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + value: BigNumber, + data: string, + txData?: Partial, + pollingIntervalMs?: number, + timeoutMs?: number, + ): PromiseWithTransactionHash { + assert.isString('destination', destination); + assert.isBigNumber('value', value); + assert.isString('data', data); + const self = this as any as AssetProxyOwnerContract; + const txHashPromise = self.submitTransaction.sendTransactionAsync(destination.toLowerCase(), + value, + data + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( destination: string, @@ -1653,29 +1797,28 @@ export class AssetProxyOwnerContract extends BaseContract { data: string, txData?: Partial | undefined, ): Promise { - assert.isString('destination', destination); - assert.isBigNumber('value', value); - assert.isString('data', data); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [ - destination.toLowerCase(), - value, - data, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('destination', destination); + assert.isBigNumber('value', value); + assert.isString('data', data); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [destination.toLowerCase(), + value, + data + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( destination: string, @@ -1683,7 +1826,8 @@ export class AssetProxyOwnerContract extends BaseContract { data: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('destination', destination); assert.isBigNumber('value', value); assert.isString('data', data); @@ -1695,12 +1839,11 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [ - destination.toLowerCase(), - value, - data, - ]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [destination.toLowerCase(), + value, + data + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1709,28 +1852,30 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('submitTransaction(address,uint256,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(destination: string, value: BigNumber, data: string): string { + getABIEncodedTransactionData( + destination: string, + value: BigNumber, + data: string, + ): string { assert.isString('destination', destination); assert.isBigNumber('value', value); assert.isString('data', data); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [ - destination.toLowerCase(), - value, - data, - ]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [destination.toLowerCase(), + value, + data + ]); return abiEncodedTransactionData; }, }; @@ -1739,7 +1884,8 @@ export class AssetProxyOwnerContract extends BaseContract { index_0: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1749,8 +1895,9 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('confirmationTimes(uint256)', [index_0]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('confirmationTimes(uint256)', [index_0 + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1759,27 +1906,33 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('confirmationTimes(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: BigNumber): string { + getABIEncodedTransactionData( + index_0: BigNumber, + ): string { assert.isBigNumber('index_0', index_0); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('confirmationTimes(uint256)', [index_0]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('confirmationTimes(uint256)', [index_0 + ]); return abiEncodedTransactionData; }, }; public MAX_OWNER_COUNT = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -1788,7 +1941,7 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; + const self = this as any as AssetProxyOwnerContract; const encodedData = self._strictEncodeArguments('MAX_OWNER_COUNT()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1798,26 +1951,30 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('MAX_OWNER_COUNT()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as AssetProxyOwnerContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as AssetProxyOwnerContract; const abiEncodedTransactionData = self._strictEncodeArguments('MAX_OWNER_COUNT()', []); return abiEncodedTransactionData; }, }; public required = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -1826,7 +1983,7 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; + const self = this as any as AssetProxyOwnerContract; const encodedData = self._strictEncodeArguments('required()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1836,20 +1993,20 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('required()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as AssetProxyOwnerContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as AssetProxyOwnerContract; const abiEncodedTransactionData = self._strictEncodeArguments('required()', []); return abiEncodedTransactionData; }, @@ -1858,30 +2015,33 @@ export class AssetProxyOwnerContract extends BaseContract { async sendTransactionAsync( owner: string, newOwner: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('owner', owner); - assert.isString('newOwner', newOwner); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [ + assert.isString('owner', owner); + assert.isString('newOwner', newOwner); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [owner.toLowerCase(), + newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.replaceOwner.estimateGasAsync.bind( + self, owner.toLowerCase(), - newOwner.toLowerCase(), - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.replaceOwner.estimateGasAsync.bind(self, owner.toLowerCase(), newOwner.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + newOwner.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( owner: string, @@ -1890,55 +2050,57 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('owner', owner); - assert.isString('newOwner', newOwner); - const self = (this as any) as AssetProxyOwnerContract; - const txHashPromise = self.replaceOwner.sendTransactionAsync( - owner.toLowerCase(), - newOwner.toLowerCase(), - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('owner', owner); + assert.isString('newOwner', newOwner); + const self = this as any as AssetProxyOwnerContract; + const txHashPromise = self.replaceOwner.sendTransactionAsync(owner.toLowerCase(), + newOwner.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(owner: string, newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('owner', owner); - assert.isString('newOwner', newOwner); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [ - owner.toLowerCase(), - newOwner.toLowerCase(), - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + owner: string, + newOwner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('owner', owner); + assert.isString('newOwner', newOwner); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [owner.toLowerCase(), + newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( owner: string, newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('owner', owner); assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -1949,11 +2111,10 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [ - owner.toLowerCase(), - newOwner.toLowerCase(), - ]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [owner.toLowerCase(), + newOwner.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1962,49 +2123,57 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('replaceOwner(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(owner: string, newOwner: string): string { + getABIEncodedTransactionData( + owner: string, + newOwner: string, + ): string { assert.isString('owner', owner); assert.isString('newOwner', newOwner); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('replaceOwner(address,address)', [ - owner.toLowerCase(), - newOwner.toLowerCase(), - ]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('replaceOwner(address,address)', [owner.toLowerCase(), + newOwner.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public executeTransaction = { - async sendTransactionAsync(transactionId: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.executeTransaction.estimateGasAsync.bind(self, transactionId), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + transactionId: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('transactionId', transactionId); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.executeTransaction.estimateGasAsync.bind( + self, + transactionId + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( transactionId: BigNumber, @@ -2012,45 +2181,51 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const txHashPromise = self.executeTransaction.sendTransactionAsync(transactionId, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('transactionId', transactionId); + const self = this as any as AssetProxyOwnerContract; + const txHashPromise = self.executeTransaction.sendTransactionAsync(transactionId + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(transactionId: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + transactionId: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('transactionId', transactionId); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( transactionId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('transactionId', transactionId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -2060,8 +2235,9 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId]); + const self = this as any as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2070,37 +2246,37 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('executeTransaction(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(transactionId: BigNumber): string { + getABIEncodedTransactionData( + transactionId: BigNumber, + ): string { assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('executeTransaction(uint256)', [ - transactionId, - ]); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId + ]); return abiEncodedTransactionData; }, }; - private readonly _subscriptionManager: SubscriptionManager; - public static async deployFrom0xArtifactAsync( +private readonly _subscriptionManager: SubscriptionManager; +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, - _owners: string[], - _assetProxyContracts: string[], - _required: BigNumber, - _secondsTimeLocked: BigNumber, + logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + _owners: string[], + _assetProxyContracts: string[], + _required: BigNumber, + _secondsTimeLocked: BigNumber, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -2113,21 +2289,12 @@ export class AssetProxyOwnerContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); - return AssetProxyOwnerContract.deployAsync( - bytecode, - abi, - provider, - txDefaults, - logDecodeDependenciesAbiOnly, - _owners, - _assetProxyContracts, - _required, - _secondsTimeLocked, - ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); + return AssetProxyOwnerContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, _owners, +_assetProxyContracts, +_required, +_secondsTimeLocked +); } public static async deployAsync( bytecode: string, @@ -2135,10 +2302,10 @@ export class AssetProxyOwnerContract extends BaseContract { supportedProvider: SupportedProvider, txDefaults: Partial, logDecodeDependencies: { [contractName: string]: ContractAbi }, - _owners: string[], - _assetProxyContracts: string[], - _required: BigNumber, - _secondsTimeLocked: BigNumber, + _owners: string[], + _assetProxyContracts: string[], + _required: BigNumber, + _secondsTimeLocked: BigNumber, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -2148,17 +2315,29 @@ export class AssetProxyOwnerContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_owners, _assetProxyContracts, _required, _secondsTimeLocked] = BaseContract._formatABIDataItemList( + [_owners, +_assetProxyContracts, +_required, +_secondsTimeLocked +] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [_owners, _assetProxyContracts, _required, _secondsTimeLocked], + [_owners, +_assetProxyContracts, +_required, +_secondsTimeLocked +], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_owners, _assetProxyContracts, _required, _secondsTimeLocked]); + const txData = deployInfo.encode(bytecode, [_owners, +_assetProxyContracts, +_required, +_secondsTimeLocked +]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -2166,22 +2345,22 @@ export class AssetProxyOwnerContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`AssetProxyOwner successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new AssetProxyOwnerContract( - txReceipt.contractAddress as string, - provider, - txDefaults, - logDecodeDependencies, - ); - contractInstance.constructorArgs = [_owners, _assetProxyContracts, _required, _secondsTimeLocked]; + const contractInstance = new AssetProxyOwnerContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); + contractInstance.constructorArgs = [_owners, +_assetProxyContracts, +_required, +_secondsTimeLocked +]; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -2200,7 +2379,7 @@ export class AssetProxyOwnerContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2209,12 +2388,13 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'removeOwner', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2223,12 +2403,13 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'revokeConfirmation', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2247,7 +2428,7 @@ export class AssetProxyOwnerContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2270,7 +2451,7 @@ export class AssetProxyOwnerContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2279,14 +2460,16 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'executeRemoveAuthorizedAddressAtIndex', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'secondsTimeLocked', outputs: [ { @@ -2298,7 +2481,7 @@ export class AssetProxyOwnerContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2321,7 +2504,7 @@ export class AssetProxyOwnerContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2334,12 +2517,13 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'registerAssetProxy', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2348,12 +2532,13 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'addOwner', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2372,7 +2557,7 @@ export class AssetProxyOwnerContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2381,12 +2566,13 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'changeTimeLock', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2405,7 +2591,7 @@ export class AssetProxyOwnerContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2424,7 +2610,7 @@ export class AssetProxyOwnerContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2455,9 +2641,10 @@ export class AssetProxyOwnerContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'getOwners', outputs: [ { @@ -2469,7 +2656,7 @@ export class AssetProxyOwnerContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2500,7 +2687,7 @@ export class AssetProxyOwnerContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2519,9 +2706,10 @@ export class AssetProxyOwnerContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'transactionCount', outputs: [ { @@ -2533,7 +2721,7 @@ export class AssetProxyOwnerContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2542,12 +2730,13 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'changeRequirement', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2556,12 +2745,13 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'confirmTransaction', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2588,7 +2778,7 @@ export class AssetProxyOwnerContract extends BaseContract { stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2607,9 +2797,10 @@ export class AssetProxyOwnerContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'MAX_OWNER_COUNT', outputs: [ { @@ -2621,9 +2812,10 @@ export class AssetProxyOwnerContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'required', outputs: [ { @@ -2635,7 +2827,7 @@ export class AssetProxyOwnerContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2648,12 +2840,13 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'replaceOwner', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2662,12 +2855,13 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'executeTransaction', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { inputs: [ { name: '_owners', @@ -2686,19 +2880,22 @@ export class AssetProxyOwnerContract extends BaseContract { type: 'uint256', }, ], - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'constructor', }, - { - inputs: [], - outputs: [], + { + inputs: [ + ], + outputs: [ + ], payable: true, stateMutability: 'payable', type: 'fallback', }, - { + { anonymous: false, inputs: [ { @@ -2713,10 +2910,11 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'AssetProxyRegistration', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -2731,10 +2929,11 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'ConfirmationTimeSet', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -2744,10 +2943,11 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'TimeLockChange', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -2762,10 +2962,11 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'Confirmation', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -2780,10 +2981,11 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'Revocation', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -2793,10 +2995,11 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'Submission', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -2806,10 +3009,11 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'Execution', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -2819,10 +3023,11 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'ExecutionFailure', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -2837,10 +3042,11 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'Deposit', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -2850,10 +3056,11 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'OwnerAddition', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -2863,10 +3070,11 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'OwnerRemoval', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -2876,7 +3084,8 @@ export class AssetProxyOwnerContract extends BaseContract { }, ], name: 'RequirementChange', - outputs: [], + outputs: [ + ], type: 'event', }, ] as ContractAbi; @@ -2950,27 +3159,15 @@ export class AssetProxyOwnerContract extends BaseContract { ); return logs; } - constructor( - address: string, - supportedProvider: SupportedProvider, - txDefaults?: Partial, - logDecodeDependencies?: { [contractName: string]: ContractAbi }, - ) { - super( - 'AssetProxyOwner', - AssetProxyOwnerContract.ABI(), - address, - supportedProvider, - txDefaults, - logDecodeDependencies, - ); + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + super('AssetProxyOwner', AssetProxyOwnerContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( AssetProxyOwnerContract.ABI(), this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts index 305e0b38aa..9c6104b686 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts @@ -1,7 +1,7 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract'; +import { BaseContract,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -23,6 +23,7 @@ import { assert } from '@0x/assert'; import * as ethers from 'ethers'; // tslint:enable:no-unused-variable + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name @@ -33,7 +34,8 @@ export class CoordinatorContract extends BaseContract { signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('hash', hash); assert.isString('signature', signature); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -44,8 +46,10 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as CoordinatorContract; - const encodedData = self._strictEncodeArguments('getSignerAddress(bytes32,bytes)', [hash, signature]); + const self = this as any as CoordinatorContract; + const encodedData = self._strictEncodeArguments('getSignerAddress(bytes32,bytes)', [hash, + signature + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -54,35 +58,38 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getSignerAddress(bytes32,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(hash: string, signature: string): string { + getABIEncodedTransactionData( + hash: string, + signature: string, + ): string { assert.isString('hash', hash); assert.isString('signature', signature); - const self = (this as any) as CoordinatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getSignerAddress(bytes32,bytes)', [ - hash, - signature, - ]); + const self = this as any as CoordinatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getSignerAddress(bytes32,bytes)', [hash, + signature + ]); return abiEncodedTransactionData; }, }; public getTransactionHash = { async callAsync( - transaction: { salt: BigNumber; signerAddress: string; data: string }, + transaction: {salt: BigNumber;signerAddress: string;data: string}, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -91,10 +98,9 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as CoordinatorContract; - const encodedData = self._strictEncodeArguments('getTransactionHash((uint256,address,bytes))', [ - transaction, - ]); + const self = this as any as CoordinatorContract; + const encodedData = self._strictEncodeArguments('getTransactionHash((uint256,address,bytes))', [transaction + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -103,38 +109,35 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + 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); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(transaction: { salt: BigNumber; signerAddress: string; data: string }): string { - const self = (this as any) as CoordinatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'getTransactionHash((uint256,address,bytes))', - [transaction], - ); + getABIEncodedTransactionData( + transaction: {salt: BigNumber;signerAddress: string;data: string}, + ): string { + + const self = this as any as CoordinatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getTransactionHash((uint256,address,bytes))', [transaction + ]); return abiEncodedTransactionData; }, }; public getCoordinatorApprovalHash = { async callAsync( - approval: { - txOrigin: string; - transactionHash: string; - transactionSignature: string; - approvalExpirationTimeSeconds: BigNumber; - }, + approval: {txOrigin: string;transactionHash: string;transactionSignature: string;approvalExpirationTimeSeconds: BigNumber}, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -143,11 +146,9 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as CoordinatorContract; - const encodedData = self._strictEncodeArguments( - 'getCoordinatorApprovalHash((address,bytes32,bytes,uint256))', - [approval], - ); + 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, @@ -156,81 +157,73 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + 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); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(approval: { - txOrigin: string; - transactionHash: string; - transactionSignature: string; - approvalExpirationTimeSeconds: BigNumber; - }): string { - const self = (this as any) as CoordinatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'getCoordinatorApprovalHash((address,bytes32,bytes,uint256))', - [approval], - ); + getABIEncodedTransactionData( + approval: {txOrigin: string;transactionHash: string;transactionSignature: string;approvalExpirationTimeSeconds: BigNumber}, + ): string { + + const self = this as any as CoordinatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getCoordinatorApprovalHash((address,bytes32,bytes,uint256))', [approval + ]); return abiEncodedTransactionData; }, }; public executeTransaction = { async sendTransactionAsync( - transaction: { salt: BigNumber; signerAddress: string; data: string }, + transaction: {salt: BigNumber;signerAddress: string;data: string}, txOrigin: string, transactionSignature: string, approvalExpirationTimeSeconds: BigNumber[], approvalSignatures: string[], - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('txOrigin', txOrigin); - assert.isString('transactionSignature', transactionSignature); - assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); - assert.isArray('approvalSignatures', approvalSignatures); - const self = (this as any) as CoordinatorContract; - const encodedData = self._strictEncodeArguments( - 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', - [ - transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures, - ], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.executeTransaction.estimateGasAsync.bind( - self, - transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures, - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + + assert.isString('txOrigin', txOrigin); + assert.isString('transactionSignature', transactionSignature); + assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); + assert.isArray('approvalSignatures', approvalSignatures); + const self = this as any as CoordinatorContract; + const encodedData = self._strictEncodeArguments('executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.executeTransaction.estimateGasAsync.bind( + self, + transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - transaction: { salt: BigNumber; signerAddress: string; data: string }, + transaction: {salt: BigNumber;signerAddress: string;data: string}, txOrigin: string, transactionSignature: string, approvalExpirationTimeSeconds: BigNumber[], @@ -239,78 +232,76 @@ export class CoordinatorContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('txOrigin', txOrigin); - assert.isString('transactionSignature', transactionSignature); - assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); - assert.isArray('approvalSignatures', approvalSignatures); - const self = (this as any) as CoordinatorContract; - const txHashPromise = self.executeTransaction.sendTransactionAsync( - transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + + assert.isString('txOrigin', txOrigin); + assert.isString('transactionSignature', transactionSignature); + assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); + assert.isArray('approvalSignatures', approvalSignatures); + const self = this as any as CoordinatorContract; + const txHashPromise = self.executeTransaction.sendTransactionAsync(transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - transaction: { salt: BigNumber; signerAddress: string; data: string }, + transaction: {salt: BigNumber;signerAddress: string;data: string}, txOrigin: string, transactionSignature: string, approvalExpirationTimeSeconds: BigNumber[], approvalSignatures: string[], txData?: Partial | undefined, ): Promise { - assert.isString('txOrigin', txOrigin); - assert.isString('transactionSignature', transactionSignature); - assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); - assert.isArray('approvalSignatures', approvalSignatures); - const self = (this as any) as CoordinatorContract; - const encodedData = self._strictEncodeArguments( - 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', - [ - transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures, - ], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + + assert.isString('txOrigin', txOrigin); + assert.isString('transactionSignature', transactionSignature); + assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); + assert.isArray('approvalSignatures', approvalSignatures); + const self = this as any as CoordinatorContract; + const encodedData = self._strictEncodeArguments('executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - transaction: { salt: BigNumber; signerAddress: string; data: string }, + transaction: {salt: BigNumber;signerAddress: string;data: string}, txOrigin: string, transactionSignature: string, approvalExpirationTimeSeconds: BigNumber[], approvalSignatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { + assert.isString('txOrigin', txOrigin); assert.isString('transactionSignature', transactionSignature); assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); @@ -323,17 +314,13 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as CoordinatorContract; - const encodedData = self._strictEncodeArguments( - 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', - [ - transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures, - ], - ); + const self = this as any as CoordinatorContract; + const encodedData = self._strictEncodeArguments('executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -342,47 +329,45 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', - ); + const abiEncoder = self._lookupAbiEncoder('executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - transaction: { salt: BigNumber; signerAddress: string; data: string }, - txOrigin: string, - transactionSignature: string, - approvalExpirationTimeSeconds: BigNumber[], - approvalSignatures: string[], - ): string { + transaction: {salt: BigNumber;signerAddress: string;data: string}, + txOrigin: string, + transactionSignature: string, + approvalExpirationTimeSeconds: BigNumber[], + approvalSignatures: string[], + ): string { + assert.isString('txOrigin', txOrigin); assert.isString('transactionSignature', transactionSignature); assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); assert.isArray('approvalSignatures', approvalSignatures); - const self = (this as any) as CoordinatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', - [ - transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures, - ], - ); + const self = this as any as CoordinatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures + ]); return abiEncodedTransactionData; }, }; public EIP712_EXCHANGE_DOMAIN_HASH = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -391,7 +376,7 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as CoordinatorContract; + const self = this as any as CoordinatorContract; const encodedData = self._strictEncodeArguments('EIP712_EXCHANGE_DOMAIN_HASH()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -401,34 +386,36 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + 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); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as CoordinatorContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as CoordinatorContract; const abiEncodedTransactionData = self._strictEncodeArguments('EIP712_EXCHANGE_DOMAIN_HASH()', []); return abiEncodedTransactionData; }, }; public assertValidCoordinatorApprovals = { async callAsync( - transaction: { salt: BigNumber; signerAddress: string; data: string }, + transaction: {salt: BigNumber;signerAddress: string;data: string}, txOrigin: string, transactionSignature: string, approvalExpirationTimeSeconds: BigNumber[], approvalSignatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { + assert.isString('txOrigin', txOrigin); assert.isString('transactionSignature', transactionSignature); assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); @@ -441,17 +428,13 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as CoordinatorContract; - const encodedData = self._strictEncodeArguments( - 'assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', - [ - transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures, - ], - ); + const self = this as any as CoordinatorContract; + const encodedData = self._strictEncodeArguments('assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -460,42 +443,36 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', - ); + const abiEncoder = self._lookupAbiEncoder('assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - transaction: { salt: BigNumber; signerAddress: string; data: string }, - txOrigin: string, - transactionSignature: string, - approvalExpirationTimeSeconds: BigNumber[], - approvalSignatures: string[], - ): string { + transaction: {salt: BigNumber;signerAddress: string;data: string}, + txOrigin: string, + transactionSignature: string, + approvalExpirationTimeSeconds: BigNumber[], + approvalSignatures: string[], + ): string { + assert.isString('txOrigin', txOrigin); assert.isString('transactionSignature', transactionSignature); assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); assert.isArray('approvalSignatures', approvalSignatures); - const self = (this as any) as CoordinatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', - [ - transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures, - ], - ); + const self = this as any as CoordinatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures + ]); return abiEncodedTransactionData; }, }; @@ -504,21 +481,7 @@ export class CoordinatorContract extends BaseContract { data: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise< - Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }> + ): Promise > { assert.isString('data', data); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -529,8 +492,9 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as CoordinatorContract; - const encodedData = self._strictEncodeArguments('decodeOrdersFromFillData(bytes)', [data]); + const self = this as any as CoordinatorContract; + const encodedData = self._strictEncodeArguments('decodeOrdersFromFillData(bytes)', [data + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -539,42 +503,33 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('decodeOrdersFromFillData(bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue< - Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }> - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue + >(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(data: string): string { + getABIEncodedTransactionData( + data: string, + ): string { assert.isString('data', data); - const self = (this as any) as CoordinatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('decodeOrdersFromFillData(bytes)', [data]); + const self = this as any as CoordinatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('decodeOrdersFromFillData(bytes)', [data + ]); return abiEncodedTransactionData; }, }; public EIP712_COORDINATOR_DOMAIN_HASH = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -583,7 +538,7 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as CoordinatorContract; + const self = this as any as CoordinatorContract; const encodedData = self._strictEncodeArguments('EIP712_COORDINATOR_DOMAIN_HASH()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -593,30 +548,30 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('EIP712_COORDINATOR_DOMAIN_HASH()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as CoordinatorContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as CoordinatorContract; const abiEncodedTransactionData = self._strictEncodeArguments('EIP712_COORDINATOR_DOMAIN_HASH()', []); return abiEncodedTransactionData; }, }; - public static async deployFrom0xArtifactAsync( +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, - _exchange: string, + logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + _exchange: string, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -629,18 +584,9 @@ export class CoordinatorContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); - return CoordinatorContract.deployAsync( - bytecode, - abi, - provider, - txDefaults, - logDecodeDependenciesAbiOnly, - _exchange, - ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); + return CoordinatorContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, _exchange +); } public static async deployAsync( bytecode: string, @@ -648,7 +594,7 @@ export class CoordinatorContract extends BaseContract { supportedProvider: SupportedProvider, txDefaults: Partial, logDecodeDependencies: { [contractName: string]: ContractAbi }, - _exchange: string, + _exchange: string, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -658,17 +604,20 @@ export class CoordinatorContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_exchange] = BaseContract._formatABIDataItemList( + [_exchange +] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [_exchange], + [_exchange +], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_exchange]); + const txData = deployInfo.encode(bytecode, [_exchange +]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -676,22 +625,19 @@ 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( - txReceipt.contractAddress as string, - provider, - txDefaults, - logDecodeDependencies, - ); - contractInstance.constructorArgs = [_exchange]; + const contractInstance = new CoordinatorContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); + contractInstance.constructorArgs = [_exchange +]; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -714,7 +660,7 @@ export class CoordinatorContract extends BaseContract { stateMutability: 'pure', type: 'function', }, - { + { constant: true, inputs: [ { @@ -733,7 +679,7 @@ export class CoordinatorContract extends BaseContract { name: 'data', type: 'bytes', }, - ], + ] }, ], name: 'getTransactionHash', @@ -747,7 +693,7 @@ export class CoordinatorContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -770,7 +716,7 @@ export class CoordinatorContract extends BaseContract { name: 'approvalExpirationTimeSeconds', type: 'uint256', }, - ], + ] }, ], name: 'getCoordinatorApprovalHash', @@ -784,7 +730,7 @@ export class CoordinatorContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -803,7 +749,7 @@ export class CoordinatorContract extends BaseContract { name: 'data', type: 'bytes', }, - ], + ] }, { name: 'txOrigin', @@ -823,14 +769,16 @@ export class CoordinatorContract extends BaseContract { }, ], name: 'executeTransaction', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'EIP712_EXCHANGE_DOMAIN_HASH', outputs: [ { @@ -842,7 +790,7 @@ export class CoordinatorContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -861,7 +809,7 @@ export class CoordinatorContract extends BaseContract { name: 'data', type: 'bytes', }, - ], + ] }, { name: 'txOrigin', @@ -881,12 +829,13 @@ export class CoordinatorContract extends BaseContract { }, ], name: 'assertValidCoordinatorApprovals', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -948,16 +897,17 @@ export class CoordinatorContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, ], payable: false, stateMutability: 'pure', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'EIP712_COORDINATOR_DOMAIN_HASH', outputs: [ { @@ -969,14 +919,15 @@ export class CoordinatorContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { inputs: [ { name: '_exchange', type: 'address', }, ], - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'constructor', @@ -984,16 +935,11 @@ export class CoordinatorContract extends BaseContract { ] as ContractAbi; return abi; } - constructor( - address: string, - supportedProvider: SupportedProvider, - txDefaults?: Partial, - logDecodeDependencies?: { [contractName: string]: ContractAbi }, - ) { + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { super('Coordinator', CoordinatorContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 50ea62a44f..717c5cddab 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts @@ -1,14 +1,11 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { - BaseContract, +import { BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager, - PromiseWithTransactionHash, -} from '@0x/base-contract'; + SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -31,7 +28,8 @@ import { assert } from '@0x/assert'; import * as ethers from 'ethers'; // tslint:enable:no-unused-variable -export type CoordinatorRegistryEventArgs = CoordinatorRegistryCoordinatorEndpointSetEventArgs; +export type CoordinatorRegistryEventArgs = + | CoordinatorRegistryCoordinatorEndpointSetEventArgs; export enum CoordinatorRegistryEvents { CoordinatorEndpointSet = 'CoordinatorEndpointSet', @@ -42,30 +40,38 @@ export interface CoordinatorRegistryCoordinatorEndpointSetEventArgs extends Deco coordinatorEndpoint: string; } + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class CoordinatorRegistryContract extends BaseContract { public setCoordinatorEndpoint = { - async sendTransactionAsync(coordinatorEndpoint: string, txData?: Partial | undefined): Promise { - assert.isString('coordinatorEndpoint', coordinatorEndpoint); - const self = (this as any) as CoordinatorRegistryContract; - const encodedData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.setCoordinatorEndpoint.estimateGasAsync.bind(self, coordinatorEndpoint), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + coordinatorEndpoint: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('coordinatorEndpoint', coordinatorEndpoint); + const self = this as any as CoordinatorRegistryContract; + const encodedData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.setCoordinatorEndpoint.estimateGasAsync.bind( + self, + coordinatorEndpoint + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( coordinatorEndpoint: string, @@ -73,45 +79,51 @@ export class CoordinatorRegistryContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('coordinatorEndpoint', coordinatorEndpoint); - const self = (this as any) as CoordinatorRegistryContract; - const txHashPromise = self.setCoordinatorEndpoint.sendTransactionAsync(coordinatorEndpoint, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('coordinatorEndpoint', coordinatorEndpoint); + const self = this as any as CoordinatorRegistryContract; + const txHashPromise = self.setCoordinatorEndpoint.sendTransactionAsync(coordinatorEndpoint + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(coordinatorEndpoint: string, txData?: Partial | undefined): Promise { - assert.isString('coordinatorEndpoint', coordinatorEndpoint); - const self = (this as any) as CoordinatorRegistryContract; - const encodedData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + coordinatorEndpoint: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('coordinatorEndpoint', coordinatorEndpoint); + const self = this as any as CoordinatorRegistryContract; + const encodedData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( coordinatorEndpoint: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('coordinatorEndpoint', coordinatorEndpoint); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -121,8 +133,9 @@ export class CoordinatorRegistryContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as CoordinatorRegistryContract; - const encodedData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint]); + const self = this as any as CoordinatorRegistryContract; + const encodedData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -131,24 +144,24 @@ export class CoordinatorRegistryContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('setCoordinatorEndpoint(string)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(coordinatorEndpoint: string): string { + getABIEncodedTransactionData( + coordinatorEndpoint: string, + ): string { assert.isString('coordinatorEndpoint', coordinatorEndpoint); - const self = (this as any) as CoordinatorRegistryContract; - const abiEncodedTransactionData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [ - coordinatorEndpoint, - ]); + const self = this as any as CoordinatorRegistryContract; + const abiEncodedTransactionData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint + ]); return abiEncodedTransactionData; }, }; @@ -157,7 +170,8 @@ export class CoordinatorRegistryContract extends BaseContract { coordinatorOperator: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('coordinatorOperator', coordinatorOperator); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -167,10 +181,9 @@ export class CoordinatorRegistryContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as CoordinatorRegistryContract; - const encodedData = self._strictEncodeArguments('getCoordinatorEndpoint(address)', [ - coordinatorOperator.toLowerCase(), - ]); + const self = this as any as CoordinatorRegistryContract; + const encodedData = self._strictEncodeArguments('getCoordinatorEndpoint(address)', [coordinatorOperator.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -179,33 +192,33 @@ export class CoordinatorRegistryContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getCoordinatorEndpoint(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(coordinatorOperator: string): string { + getABIEncodedTransactionData( + coordinatorOperator: string, + ): string { assert.isString('coordinatorOperator', coordinatorOperator); - const self = (this as any) as CoordinatorRegistryContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getCoordinatorEndpoint(address)', [ - coordinatorOperator.toLowerCase(), - ]); + const self = this as any as CoordinatorRegistryContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getCoordinatorEndpoint(address)', [coordinatorOperator.toLowerCase() + ]); return abiEncodedTransactionData; }, }; - private readonly _subscriptionManager: SubscriptionManager; - public static async deployFrom0xArtifactAsync( +private readonly _subscriptionManager: SubscriptionManager; +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -218,17 +231,8 @@ export class CoordinatorRegistryContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); - return CoordinatorRegistryContract.deployAsync( - bytecode, - abi, - provider, - txDefaults, - logDecodeDependenciesAbiOnly, - ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); + return CoordinatorRegistryContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, ); } public static async deployAsync( bytecode: string, @@ -245,13 +249,17 @@ export class CoordinatorRegistryContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); + [] = BaseContract._formatABIDataItemList( + constructorAbi.inputs, + [], + BaseContract._bigNumberToString, + ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -259,22 +267,18 @@ export class CoordinatorRegistryContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`CoordinatorRegistry successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new CoordinatorRegistryContract( - txReceipt.contractAddress as string, - provider, - txDefaults, - logDecodeDependencies, - ); + const contractInstance = new CoordinatorRegistryContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); contractInstance.constructorArgs = []; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: false, inputs: [ { @@ -283,12 +287,13 @@ export class CoordinatorRegistryContract extends BaseContract { }, ], name: 'setCoordinatorEndpoint', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -307,14 +312,16 @@ export class CoordinatorRegistryContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { - inputs: [], - outputs: [], + { + inputs: [ + ], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'constructor', }, - { + { anonymous: false, inputs: [ { @@ -329,7 +336,8 @@ export class CoordinatorRegistryContract extends BaseContract { }, ], name: 'CoordinatorEndpointSet', - outputs: [], + outputs: [ + ], type: 'event', }, ] as ContractAbi; @@ -403,27 +411,15 @@ export class CoordinatorRegistryContract extends BaseContract { ); return logs; } - constructor( - address: string, - supportedProvider: SupportedProvider, - txDefaults?: Partial, - logDecodeDependencies?: { [contractName: string]: ContractAbi }, - ) { - super( - 'CoordinatorRegistry', - CoordinatorRegistryContract.ABI(), - address, - supportedProvider, - txDefaults, - logDecodeDependencies, - ); + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + super('CoordinatorRegistry', CoordinatorRegistryContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( CoordinatorRegistryContract.ABI(), this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 7947130b0d..86ae2b9e90 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 @@ -1,14 +1,11 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { - BaseContract, +import { BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager, - PromiseWithTransactionHash, -} from '@0x/base-contract'; + SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -31,7 +28,9 @@ import { assert } from '@0x/assert'; import * as ethers from 'ethers'; // tslint:enable:no-unused-variable -export type DummyERC20TokenEventArgs = DummyERC20TokenTransferEventArgs | DummyERC20TokenApprovalEventArgs; +export type DummyERC20TokenEventArgs = + | DummyERC20TokenTransferEventArgs + | DummyERC20TokenApprovalEventArgs; export enum DummyERC20TokenEvents { Transfer = 'Transfer', @@ -50,12 +49,17 @@ export interface DummyERC20TokenApprovalEventArgs extends DecodedLogArgs { _value: BigNumber; } + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class DummyERC20TokenContract extends BaseContract { public name = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -64,7 +68,7 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC20TokenContract; + const self = this as any as DummyERC20TokenContract; const encodedData = self._strictEncodeArguments('name()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -74,20 +78,20 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('name()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as DummyERC20TokenContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as DummyERC20TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('name()', []); return abiEncodedTransactionData; }, @@ -96,30 +100,33 @@ export class DummyERC20TokenContract extends BaseContract { async sendTransactionAsync( _spender: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.approve.estimateGasAsync.bind( + self, _spender.toLowerCase(), - _value, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind(self, _spender.toLowerCase(), _value), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _value + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _spender: string, @@ -128,55 +135,57 @@ export class DummyERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const txHashPromise = self.approve.sendTransactionAsync(_spender.toLowerCase(), _value, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = this as any as DummyERC20TokenContract; + const txHashPromise = self.approve.sendTransactionAsync(_spender.toLowerCase(), + _value + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _spender: string, _value: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ - _spender.toLowerCase(), - _value, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _spender: string, _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -187,11 +196,10 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ - _spender.toLowerCase(), - _value, - ]); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), + _value + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -200,31 +208,36 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_spender: string, _value: BigNumber): string { + getABIEncodedTransactionData( + _spender: string, + _value: BigNumber, + ): string { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [ - _spender.toLowerCase(), - _value, - ]); + const self = this as any as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), + _value + ]); return abiEncodedTransactionData; }, }; public totalSupply = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -233,7 +246,7 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC20TokenContract; + const self = this as any as DummyERC20TokenContract; const encodedData = self._strictEncodeArguments('totalSupply()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -243,20 +256,20 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('totalSupply()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as DummyERC20TokenContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as DummyERC20TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('totalSupply()', []); return abiEncodedTransactionData; }, @@ -266,32 +279,36 @@ export class DummyERC20TokenContract extends BaseContract { _from: string, _to: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferFrom.estimateGasAsync.bind( + self, _from.toLowerCase(), _to.toLowerCase(), - _value, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _value), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _value + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -301,27 +318,25 @@ export class DummyERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const txHashPromise = self.transferFrom.sendTransactionAsync( - _from.toLowerCase(), - _to.toLowerCase(), - _value, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as DummyERC20TokenContract; + const txHashPromise = self.transferFrom.sendTransactionAsync(_from.toLowerCase(), + _to.toLowerCase(), + _value + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -329,29 +344,28 @@ export class DummyERC20TokenContract extends BaseContract { _value: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _value, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -359,7 +373,8 @@ export class DummyERC20TokenContract extends BaseContract { _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_value', _value); @@ -371,12 +386,11 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _value, - ]); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _value + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -385,33 +399,39 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_from: string, _to: string, _value: BigNumber): string { + getABIEncodedTransactionData( + _from: string, + _to: string, + _value: BigNumber, + ): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _value, - ]); + const self = this as any as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _value + ]); return abiEncodedTransactionData; }, }; public decimals = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -420,7 +440,7 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC20TokenContract; + const self = this as any as DummyERC20TokenContract; const encodedData = self._strictEncodeArguments('decimals()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -430,20 +450,20 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('decimals()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as DummyERC20TokenContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as DummyERC20TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('decimals()', []); return abiEncodedTransactionData; }, @@ -453,7 +473,8 @@ export class DummyERC20TokenContract extends BaseContract { _owner: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -463,8 +484,9 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -473,27 +495,33 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_owner: string): string { + getABIEncodedTransactionData( + _owner: string, + ): string { assert.isString('_owner', _owner); - const self = (this as any) as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); + const self = this as any as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public owner = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -502,7 +530,7 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC20TokenContract; + const self = this as any as DummyERC20TokenContract; const encodedData = self._strictEncodeArguments('owner()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -512,26 +540,30 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as DummyERC20TokenContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as DummyERC20TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); return abiEncodedTransactionData; }, }; public symbol = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -540,7 +572,7 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC20TokenContract; + const self = this as any as DummyERC20TokenContract; const encodedData = self._strictEncodeArguments('symbol()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -550,44 +582,51 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('symbol()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as DummyERC20TokenContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as DummyERC20TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('symbol()', []); return abiEncodedTransactionData; }, }; public mint = { - async sendTransactionAsync(_value: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('mint(uint256)', [_value]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.mint.estimateGasAsync.bind(self, _value), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + _value: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('_value', _value); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('mint(uint256)', [_value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.mint.estimateGasAsync.bind( + self, + _value + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _value: BigNumber, @@ -595,41 +634,51 @@ export class DummyERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const txHashPromise = self.mint.sendTransactionAsync(_value, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('_value', _value); + const self = this as any as DummyERC20TokenContract; + const txHashPromise = self.mint.sendTransactionAsync(_value + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(_value: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('mint(uint256)', [_value]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + _value: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('_value', _value); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('mint(uint256)', [_value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(_value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + _value: BigNumber, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isBigNumber('_value', _value); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -639,8 +688,9 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('mint(uint256)', [_value]); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('mint(uint256)', [_value + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -649,22 +699,24 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('mint(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_value: BigNumber): string { + getABIEncodedTransactionData( + _value: BigNumber, + ): string { assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('mint(uint256)', [_value]); + const self = this as any as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('mint(uint256)', [_value + ]); return abiEncodedTransactionData; }, }; @@ -672,27 +724,33 @@ export class DummyERC20TokenContract extends BaseContract { async sendTransactionAsync( _to: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transfer.estimateGasAsync.bind(self, _to.toLowerCase(), _value), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transfer.estimateGasAsync.bind( + self, + _to.toLowerCase(), + _value + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _to: string, @@ -701,48 +759,57 @@ export class DummyERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const txHashPromise = self.transfer.sendTransactionAsync(_to.toLowerCase(), _value, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as DummyERC20TokenContract; + const txHashPromise = self.transfer.sendTransactionAsync(_to.toLowerCase(), + _value + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(_to: string, _value: BigNumber, txData?: Partial | undefined): Promise { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + _to: string, + _value: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _to: string, _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_to', _to); assert.isBigNumber('_value', _value); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -753,8 +820,10 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), + _value + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -763,26 +832,27 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_to: string, _value: BigNumber): string { + getABIEncodedTransactionData( + _to: string, + _value: BigNumber, + ): string { assert.isString('_to', _to); assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [ - _to.toLowerCase(), - _value, - ]); + const self = this as any as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), + _value + ]); return abiEncodedTransactionData; }, }; @@ -792,7 +862,8 @@ export class DummyERC20TokenContract extends BaseContract { _spender: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.isString('_spender', _spender); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -803,11 +874,10 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('allowance(address,address)', [ - _owner.toLowerCase(), - _spender.toLowerCase(), - ]); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('allowance(address,address)', [_owner.toLowerCase(), + _spender.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -816,26 +886,27 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_owner: string, _spender: string): string { + getABIEncodedTransactionData( + _owner: string, + _spender: string, + ): string { assert.isString('_owner', _owner); assert.isString('_spender', _spender); - const self = (this as any) as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [ - _owner.toLowerCase(), - _spender.toLowerCase(), - ]); + const self = this as any as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [_owner.toLowerCase(), + _spender.toLowerCase() + ]); return abiEncodedTransactionData; }, }; @@ -843,30 +914,33 @@ export class DummyERC20TokenContract extends BaseContract { async sendTransactionAsync( _target: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_target', _target); - assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [ + assert.isString('_target', _target); + assert.isBigNumber('_value', _value); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [_target.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.setBalance.estimateGasAsync.bind( + self, _target.toLowerCase(), - _value, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.setBalance.estimateGasAsync.bind(self, _target.toLowerCase(), _value), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _value + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _target: string, @@ -875,55 +949,57 @@ export class DummyERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_target', _target); - assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const txHashPromise = self.setBalance.sendTransactionAsync(_target.toLowerCase(), _value, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_target', _target); + assert.isBigNumber('_value', _value); + const self = this as any as DummyERC20TokenContract; + const txHashPromise = self.setBalance.sendTransactionAsync(_target.toLowerCase(), + _value + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _target: string, _value: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_target', _target); - assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [ - _target.toLowerCase(), - _value, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_target', _target); + assert.isBigNumber('_value', _value); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [_target.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _target: string, _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_target', _target); assert.isBigNumber('_value', _value); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -934,11 +1010,10 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [ - _target.toLowerCase(), - _value, - ]); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [_target.toLowerCase(), + _value + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -947,49 +1022,57 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('setBalance(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_target: string, _value: BigNumber): string { + getABIEncodedTransactionData( + _target: string, + _value: BigNumber, + ): string { assert.isString('_target', _target); assert.isBigNumber('_value', _value); - const self = (this as any) as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('setBalance(address,uint256)', [ - _target.toLowerCase(), - _value, - ]); + const self = this as any as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('setBalance(address,uint256)', [_target.toLowerCase(), + _value + ]); return abiEncodedTransactionData; }, }; public transferOwnership = { - async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + newOwner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('newOwner', newOwner); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferOwnership.estimateGasAsync.bind( + self, + newOwner.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( newOwner: string, @@ -997,41 +1080,51 @@ export class DummyERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('newOwner', newOwner); - const self = (this as any) as DummyERC20TokenContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('newOwner', newOwner); + const self = this as any as DummyERC20TokenContract; + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + newOwner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('newOwner', newOwner); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + newOwner: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1041,8 +1134,9 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const self = this as any as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1051,29 +1145,33 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(newOwner: string): string { + getABIEncodedTransactionData( + newOwner: string, + ): string { assert.isString('newOwner', newOwner); - const self = (this as any) as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ - newOwner.toLowerCase(), - ]); + const self = this as any as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public MAX_MINT_AMOUNT = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -1082,7 +1180,7 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC20TokenContract; + const self = this as any as DummyERC20TokenContract; const encodedData = self._strictEncodeArguments('MAX_MINT_AMOUNT()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1092,34 +1190,34 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('MAX_MINT_AMOUNT()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as DummyERC20TokenContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as DummyERC20TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('MAX_MINT_AMOUNT()', []); return abiEncodedTransactionData; }, }; - private readonly _subscriptionManager: SubscriptionManager; - public static async deployFrom0xArtifactAsync( +private readonly _subscriptionManager: SubscriptionManager; +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, - _name: string, - _symbol: string, - _decimals: BigNumber, - _totalSupply: BigNumber, + logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + _name: string, + _symbol: string, + _decimals: BigNumber, + _totalSupply: BigNumber, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -1132,21 +1230,12 @@ export class DummyERC20TokenContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); - return DummyERC20TokenContract.deployAsync( - bytecode, - abi, - provider, - txDefaults, - logDecodeDependenciesAbiOnly, - _name, - _symbol, - _decimals, - _totalSupply, - ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); + return DummyERC20TokenContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, _name, +_symbol, +_decimals, +_totalSupply +); } public static async deployAsync( bytecode: string, @@ -1154,10 +1243,10 @@ export class DummyERC20TokenContract extends BaseContract { supportedProvider: SupportedProvider, txDefaults: Partial, logDecodeDependencies: { [contractName: string]: ContractAbi }, - _name: string, - _symbol: string, - _decimals: BigNumber, - _totalSupply: BigNumber, + _name: string, + _symbol: string, + _decimals: BigNumber, + _totalSupply: BigNumber, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -1167,17 +1256,29 @@ export class DummyERC20TokenContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_name, _symbol, _decimals, _totalSupply] = BaseContract._formatABIDataItemList( + [_name, +_symbol, +_decimals, +_totalSupply +] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [_name, _symbol, _decimals, _totalSupply], + [_name, +_symbol, +_decimals, +_totalSupply +], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_name, _symbol, _decimals, _totalSupply]); + const txData = deployInfo.encode(bytecode, [_name, +_symbol, +_decimals, +_totalSupply +]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -1185,24 +1286,25 @@ export class DummyERC20TokenContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`DummyERC20Token successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new DummyERC20TokenContract( - txReceipt.contractAddress as string, - provider, - txDefaults, - logDecodeDependencies, - ); - contractInstance.constructorArgs = [_name, _symbol, _decimals, _totalSupply]; + const contractInstance = new DummyERC20TokenContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); + contractInstance.constructorArgs = [_name, +_symbol, +_decimals, +_totalSupply +]; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'name', outputs: [ { @@ -1214,7 +1316,7 @@ export class DummyERC20TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1237,9 +1339,10 @@ export class DummyERC20TokenContract extends BaseContract { stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'totalSupply', outputs: [ { @@ -1251,7 +1354,7 @@ export class DummyERC20TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1278,9 +1381,10 @@ export class DummyERC20TokenContract extends BaseContract { stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'decimals', outputs: [ { @@ -1292,7 +1396,7 @@ export class DummyERC20TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1311,9 +1415,10 @@ export class DummyERC20TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'owner', outputs: [ { @@ -1325,9 +1430,10 @@ export class DummyERC20TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'symbol', outputs: [ { @@ -1339,7 +1445,7 @@ export class DummyERC20TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1348,12 +1454,13 @@ export class DummyERC20TokenContract extends BaseContract { }, ], name: 'mint', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1376,7 +1483,7 @@ export class DummyERC20TokenContract extends BaseContract { stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1399,7 +1506,7 @@ export class DummyERC20TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1412,12 +1519,13 @@ export class DummyERC20TokenContract extends BaseContract { }, ], name: 'setBalance', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1426,14 +1534,16 @@ export class DummyERC20TokenContract extends BaseContract { }, ], name: 'transferOwnership', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'MAX_MINT_AMOUNT', outputs: [ { @@ -1445,7 +1555,7 @@ export class DummyERC20TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { inputs: [ { name: '_name', @@ -1464,12 +1574,13 @@ export class DummyERC20TokenContract extends BaseContract { type: 'uint256', }, ], - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'constructor', }, - { + { anonymous: false, inputs: [ { @@ -1489,10 +1600,11 @@ export class DummyERC20TokenContract extends BaseContract { }, ], name: 'Transfer', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1512,7 +1624,8 @@ export class DummyERC20TokenContract extends BaseContract { }, ], name: 'Approval', - outputs: [], + outputs: [ + ], type: 'event', }, ] as ContractAbi; @@ -1586,27 +1699,15 @@ export class DummyERC20TokenContract extends BaseContract { ); return logs; } - constructor( - address: string, - supportedProvider: SupportedProvider, - txDefaults?: Partial, - logDecodeDependencies?: { [contractName: string]: ContractAbi }, - ) { - super( - 'DummyERC20Token', - DummyERC20TokenContract.ABI(), - address, - supportedProvider, - txDefaults, - logDecodeDependencies, - ); + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + super('DummyERC20Token', DummyERC20TokenContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( DummyERC20TokenContract.ABI(), this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 c3ad0fed54..9f3e0bad87 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 @@ -1,14 +1,11 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { - BaseContract, +import { BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager, - PromiseWithTransactionHash, -} from '@0x/base-contract'; + SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -60,12 +57,17 @@ export interface DummyERC721TokenApprovalForAllEventArgs extends DecodedLogArgs _approved: boolean; } + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class DummyERC721TokenContract extends BaseContract { public name = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -74,7 +76,7 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC721TokenContract; + const self = this as any as DummyERC721TokenContract; const encodedData = self._strictEncodeArguments('name()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -84,20 +86,20 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('name()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as DummyERC721TokenContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as DummyERC721TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('name()', []); return abiEncodedTransactionData; }, @@ -107,7 +109,8 @@ export class DummyERC721TokenContract extends BaseContract { _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('_tokenId', _tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -117,8 +120,9 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId]); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -127,22 +131,24 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getApproved(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_tokenId: BigNumber): string { + getABIEncodedTransactionData( + _tokenId: BigNumber, + ): string { assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId]); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId + ]); return abiEncodedTransactionData; }, }; @@ -150,30 +156,33 @@ export class DummyERC721TokenContract extends BaseContract { async sendTransactionAsync( _approved: string, _tokenId: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_approved', _approved); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + assert.isString('_approved', _approved); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(), + _tokenId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.approve.estimateGasAsync.bind( + self, _approved.toLowerCase(), - _tokenId, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind(self, _approved.toLowerCase(), _tokenId), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _tokenId + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _approved: string, @@ -182,55 +191,57 @@ export class DummyERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_approved', _approved); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const txHashPromise = self.approve.sendTransactionAsync(_approved.toLowerCase(), _tokenId, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_approved', _approved); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const txHashPromise = self.approve.sendTransactionAsync(_approved.toLowerCase(), + _tokenId + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _approved: string, _tokenId: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_approved', _approved); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ - _approved.toLowerCase(), - _tokenId, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_approved', _approved); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(), + _tokenId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _approved: string, _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_approved', _approved); assert.isBigNumber('_tokenId', _tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -241,11 +252,10 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ - _approved.toLowerCase(), - _tokenId, - ]); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(), + _tokenId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -254,26 +264,27 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_approved: string, _tokenId: BigNumber): string { + getABIEncodedTransactionData( + _approved: string, + _tokenId: BigNumber, + ): string { assert.isString('_approved', _approved); assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [ - _approved.toLowerCase(), - _tokenId, - ]); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(), + _tokenId + ]); return abiEncodedTransactionData; }, }; @@ -282,32 +293,36 @@ export class DummyERC721TokenContract extends BaseContract { _from: string, _to: string, _tokenId: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferFrom.estimateGasAsync.bind( + self, _from.toLowerCase(), _to.toLowerCase(), - _tokenId, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _tokenId), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _tokenId + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -317,27 +332,25 @@ export class DummyERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const txHashPromise = self.transferFrom.sendTransactionAsync( - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const txHashPromise = self.transferFrom.sendTransactionAsync(_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -345,29 +358,28 @@ export class DummyERC721TokenContract extends BaseContract { _tokenId: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -375,7 +387,8 @@ export class DummyERC721TokenContract extends BaseContract { _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); @@ -387,12 +400,11 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - ]); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -401,28 +413,30 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_from: string, _to: string, _tokenId: BigNumber): string { + getABIEncodedTransactionData( + _from: string, + _to: string, + _tokenId: BigNumber, + ): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - ]); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + ]); return abiEncodedTransactionData; }, }; @@ -430,27 +444,33 @@ export class DummyERC721TokenContract extends BaseContract { async sendTransactionAsync( _to: string, _tokenId: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to.toLowerCase(), _tokenId]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.mint.estimateGasAsync.bind(self, _to.toLowerCase(), _tokenId), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to.toLowerCase(), + _tokenId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.mint.estimateGasAsync.bind( + self, + _to.toLowerCase(), + _tokenId + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _to: string, @@ -459,52 +479,57 @@ export class DummyERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const txHashPromise = self.mint.sendTransactionAsync(_to.toLowerCase(), _tokenId, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const txHashPromise = self.mint.sendTransactionAsync(_to.toLowerCase(), + _tokenId + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _to: string, _tokenId: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to.toLowerCase(), _tokenId]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to.toLowerCase(), + _tokenId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _to: string, _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -515,8 +540,10 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to.toLowerCase(), _tokenId]); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to.toLowerCase(), + _tokenId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -525,26 +552,27 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('mint(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_to: string, _tokenId: BigNumber): string { + getABIEncodedTransactionData( + _to: string, + _tokenId: BigNumber, + ): string { assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('mint(address,uint256)', [ - _to.toLowerCase(), - _tokenId, - ]); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('mint(address,uint256)', [_to.toLowerCase(), + _tokenId + ]); return abiEncodedTransactionData; }, }; @@ -553,32 +581,36 @@ export class DummyERC721TokenContract extends BaseContract { _from: string, _to: string, _tokenId: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.safeTransferFrom1.estimateGasAsync.bind( + self, _from.toLowerCase(), _to.toLowerCase(), - _tokenId, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.safeTransferFrom1.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _tokenId), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _tokenId + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -588,27 +620,25 @@ export class DummyERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const txHashPromise = self.safeTransferFrom1.sendTransactionAsync( - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const txHashPromise = self.safeTransferFrom1.sendTransactionAsync(_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -616,29 +646,28 @@ export class DummyERC721TokenContract extends BaseContract { _tokenId: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -646,7 +675,8 @@ export class DummyERC721TokenContract extends BaseContract { _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); @@ -658,12 +688,11 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - ]); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -672,28 +701,30 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_from: string, _to: string, _tokenId: BigNumber): string { + getABIEncodedTransactionData( + _from: string, + _to: string, + _tokenId: BigNumber, + ): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - ]); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + ]); return abiEncodedTransactionData; }, }; @@ -702,7 +733,8 @@ export class DummyERC721TokenContract extends BaseContract { _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('_tokenId', _tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -712,8 +744,9 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId]); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -722,22 +755,24 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('ownerOf(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_tokenId: BigNumber): string { + getABIEncodedTransactionData( + _tokenId: BigNumber, + ): string { assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId]); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId + ]); return abiEncodedTransactionData; }, }; @@ -746,7 +781,8 @@ export class DummyERC721TokenContract extends BaseContract { _owner: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -756,8 +792,9 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -766,27 +803,33 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_owner: string): string { + getABIEncodedTransactionData( + _owner: string, + ): string { assert.isString('_owner', _owner); - const self = (this as any) as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public owner = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -795,7 +838,7 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC721TokenContract; + const self = this as any as DummyERC721TokenContract; const encodedData = self._strictEncodeArguments('owner()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -805,26 +848,30 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as DummyERC721TokenContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as DummyERC721TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); return abiEncodedTransactionData; }, }; public symbol = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -833,7 +880,7 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC721TokenContract; + const self = this as any as DummyERC721TokenContract; const encodedData = self._strictEncodeArguments('symbol()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -843,20 +890,20 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('symbol()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as DummyERC721TokenContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as DummyERC721TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('symbol()', []); return abiEncodedTransactionData; }, @@ -865,27 +912,33 @@ export class DummyERC721TokenContract extends BaseContract { async sendTransactionAsync( _owner: string, _tokenId: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_owner', _owner); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner.toLowerCase(), _tokenId]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.burn.estimateGasAsync.bind(self, _owner.toLowerCase(), _tokenId), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isString('_owner', _owner); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner.toLowerCase(), + _tokenId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.burn.estimateGasAsync.bind( + self, + _owner.toLowerCase(), + _tokenId + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _owner: string, @@ -894,52 +947,57 @@ export class DummyERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_owner', _owner); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const txHashPromise = self.burn.sendTransactionAsync(_owner.toLowerCase(), _tokenId, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_owner', _owner); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const txHashPromise = self.burn.sendTransactionAsync(_owner.toLowerCase(), + _tokenId + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _owner: string, _tokenId: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_owner', _owner); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner.toLowerCase(), _tokenId]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_owner', _owner); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner.toLowerCase(), + _tokenId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _owner: string, _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.isBigNumber('_tokenId', _tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -950,8 +1008,10 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner.toLowerCase(), _tokenId]); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner.toLowerCase(), + _tokenId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -960,26 +1020,27 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('burn(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_owner: string, _tokenId: BigNumber): string { + getABIEncodedTransactionData( + _owner: string, + _tokenId: BigNumber, + ): string { assert.isString('_owner', _owner); assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('burn(address,uint256)', [ - _owner.toLowerCase(), - _tokenId, - ]); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('burn(address,uint256)', [_owner.toLowerCase(), + _tokenId + ]); return abiEncodedTransactionData; }, }; @@ -987,30 +1048,33 @@ export class DummyERC721TokenContract extends BaseContract { async sendTransactionAsync( _operator: string, _approved: boolean, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_operator', _operator); - assert.isBoolean('_approved', _approved); - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ + assert.isString('_operator', _operator); + assert.isBoolean('_approved', _approved); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(), + _approved + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.setApprovalForAll.estimateGasAsync.bind( + self, _operator.toLowerCase(), - _approved, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.setApprovalForAll.estimateGasAsync.bind(self, _operator.toLowerCase(), _approved), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _approved + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _operator: string, @@ -1019,59 +1083,57 @@ export class DummyERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_operator', _operator); - assert.isBoolean('_approved', _approved); - const self = (this as any) as DummyERC721TokenContract; - const txHashPromise = self.setApprovalForAll.sendTransactionAsync( - _operator.toLowerCase(), - _approved, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_operator', _operator); + assert.isBoolean('_approved', _approved); + const self = this as any as DummyERC721TokenContract; + const txHashPromise = self.setApprovalForAll.sendTransactionAsync(_operator.toLowerCase(), + _approved + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _operator: string, _approved: boolean, txData?: Partial | undefined, ): Promise { - assert.isString('_operator', _operator); - assert.isBoolean('_approved', _approved); - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ - _operator.toLowerCase(), - _approved, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_operator', _operator); + assert.isBoolean('_approved', _approved); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(), + _approved + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _operator: string, _approved: boolean, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_operator', _operator); assert.isBoolean('_approved', _approved); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -1082,11 +1144,10 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ - _operator.toLowerCase(), - _approved, - ]); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(), + _approved + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1095,26 +1156,27 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_operator: string, _approved: boolean): string { + getABIEncodedTransactionData( + _operator: string, + _approved: boolean, + ): string { assert.isString('_operator', _operator); assert.isBoolean('_approved', _approved); - const self = (this as any) as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ - _operator.toLowerCase(), - _approved, - ]); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(), + _approved + ]); return abiEncodedTransactionData; }, }; @@ -1124,40 +1186,39 @@ export class DummyERC721TokenContract extends BaseContract { _to: string, _tokenId: BigNumber, _data: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - assert.isString('_data', _data); - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [ + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + assert.isString('_data', _data); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.safeTransferFrom2.estimateGasAsync.bind( + self, _from.toLowerCase(), _to.toLowerCase(), _tokenId, - _data, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.safeTransferFrom2.estimateGasAsync.bind( - self, - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data, - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _data + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -1168,29 +1229,27 @@ export class DummyERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - assert.isString('_data', _data); - const self = (this as any) as DummyERC721TokenContract; - const txHashPromise = self.safeTransferFrom2.sendTransactionAsync( - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + assert.isString('_data', _data); + const self = this as any as DummyERC721TokenContract; + const txHashPromise = self.safeTransferFrom2.sendTransactionAsync(_from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -1199,31 +1258,30 @@ export class DummyERC721TokenContract extends BaseContract { _data: string, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - assert.isString('_data', _data); - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + assert.isString('_data', _data); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -1232,7 +1290,8 @@ export class DummyERC721TokenContract extends BaseContract { _data: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); @@ -1245,13 +1304,12 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data, - ]); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1260,28 +1318,33 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_from: string, _to: string, _tokenId: BigNumber, _data: string): string { + getABIEncodedTransactionData( + _from: string, + _to: string, + _tokenId: BigNumber, + _data: string, + ): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); assert.isString('_data', _data); - const self = (this as any) as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'safeTransferFrom(address,address,uint256,bytes)', - [_from.toLowerCase(), _to.toLowerCase(), _tokenId, _data], - ); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data + ]); return abiEncodedTransactionData; }, }; @@ -1291,7 +1354,8 @@ export class DummyERC721TokenContract extends BaseContract { _operator: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.isString('_operator', _operator); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -1302,11 +1366,10 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('isApprovedForAll(address,address)', [ - _owner.toLowerCase(), - _operator.toLowerCase(), - ]); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('isApprovedForAll(address,address)', [_owner.toLowerCase(), + _operator.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1315,49 +1378,57 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isApprovedForAll(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_owner: string, _operator: string): string { + getABIEncodedTransactionData( + _owner: string, + _operator: string, + ): string { assert.isString('_owner', _owner); assert.isString('_operator', _operator); - const self = (this as any) as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('isApprovedForAll(address,address)', [ - _owner.toLowerCase(), - _operator.toLowerCase(), - ]); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isApprovedForAll(address,address)', [_owner.toLowerCase(), + _operator.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public transferOwnership = { - async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + newOwner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('newOwner', newOwner); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferOwnership.estimateGasAsync.bind( + self, + newOwner.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( newOwner: string, @@ -1365,41 +1436,51 @@ export class DummyERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('newOwner', newOwner); - const self = (this as any) as DummyERC721TokenContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('newOwner', newOwner); + const self = this as any as DummyERC721TokenContract; + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + newOwner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('newOwner', newOwner); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + newOwner: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1409,8 +1490,9 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const self = this as any as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1419,35 +1501,35 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(newOwner: string): string { + getABIEncodedTransactionData( + newOwner: string, + ): string { assert.isString('newOwner', newOwner); - const self = (this as any) as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ - newOwner.toLowerCase(), - ]); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); return abiEncodedTransactionData; }, }; - private readonly _subscriptionManager: SubscriptionManager; - public static async deployFrom0xArtifactAsync( +private readonly _subscriptionManager: SubscriptionManager; +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, - _name: string, - _symbol: string, + logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + _name: string, + _symbol: string, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -1460,19 +1542,10 @@ export class DummyERC721TokenContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); - return DummyERC721TokenContract.deployAsync( - bytecode, - abi, - provider, - txDefaults, - logDecodeDependenciesAbiOnly, - _name, - _symbol, - ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); + return DummyERC721TokenContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, _name, +_symbol +); } public static async deployAsync( bytecode: string, @@ -1480,8 +1553,8 @@ export class DummyERC721TokenContract extends BaseContract { supportedProvider: SupportedProvider, txDefaults: Partial, logDecodeDependencies: { [contractName: string]: ContractAbi }, - _name: string, - _symbol: string, + _name: string, + _symbol: string, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -1491,17 +1564,23 @@ export class DummyERC721TokenContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_name, _symbol] = BaseContract._formatABIDataItemList( + [_name, +_symbol +] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [_name, _symbol], + [_name, +_symbol +], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_name, _symbol]); + const txData = deployInfo.encode(bytecode, [_name, +_symbol +]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -1509,24 +1588,23 @@ export class DummyERC721TokenContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`DummyERC721Token successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new DummyERC721TokenContract( - txReceipt.contractAddress as string, - provider, - txDefaults, - logDecodeDependencies, - ); - contractInstance.constructorArgs = [_name, _symbol]; + const contractInstance = new DummyERC721TokenContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); + contractInstance.constructorArgs = [_name, +_symbol +]; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'name', outputs: [ { @@ -1538,7 +1616,7 @@ export class DummyERC721TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1557,7 +1635,7 @@ export class DummyERC721TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1570,12 +1648,13 @@ export class DummyERC721TokenContract extends BaseContract { }, ], name: 'approve', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1592,12 +1671,13 @@ export class DummyERC721TokenContract extends BaseContract { }, ], name: 'transferFrom', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1610,12 +1690,13 @@ export class DummyERC721TokenContract extends BaseContract { }, ], name: 'mint', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1632,12 +1713,13 @@ export class DummyERC721TokenContract extends BaseContract { }, ], name: 'safeTransferFrom', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1656,7 +1738,7 @@ export class DummyERC721TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1675,9 +1757,10 @@ export class DummyERC721TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'owner', outputs: [ { @@ -1689,9 +1772,10 @@ export class DummyERC721TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'symbol', outputs: [ { @@ -1703,7 +1787,7 @@ export class DummyERC721TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1716,12 +1800,13 @@ export class DummyERC721TokenContract extends BaseContract { }, ], name: 'burn', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1734,12 +1819,13 @@ export class DummyERC721TokenContract extends BaseContract { }, ], name: 'setApprovalForAll', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1760,12 +1846,13 @@ export class DummyERC721TokenContract extends BaseContract { }, ], name: 'safeTransferFrom', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1788,7 +1875,7 @@ export class DummyERC721TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1797,12 +1884,13 @@ export class DummyERC721TokenContract extends BaseContract { }, ], name: 'transferOwnership', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { inputs: [ { name: '_name', @@ -1813,12 +1901,13 @@ export class DummyERC721TokenContract extends BaseContract { type: 'string', }, ], - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'constructor', }, - { + { anonymous: false, inputs: [ { @@ -1838,10 +1927,11 @@ export class DummyERC721TokenContract extends BaseContract { }, ], name: 'Transfer', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1861,10 +1951,11 @@ export class DummyERC721TokenContract extends BaseContract { }, ], name: 'Approval', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1884,7 +1975,8 @@ export class DummyERC721TokenContract extends BaseContract { }, ], name: 'ApprovalForAll', - outputs: [], + outputs: [ + ], type: 'event', }, ] as ContractAbi; @@ -1958,27 +2050,15 @@ export class DummyERC721TokenContract extends BaseContract { ); return logs; } - constructor( - address: string, - supportedProvider: SupportedProvider, - txDefaults?: Partial, - logDecodeDependencies?: { [contractName: string]: ContractAbi }, - ) { - super( - 'DummyERC721Token', - DummyERC721TokenContract.ABI(), - address, - supportedProvider, - txDefaults, - logDecodeDependencies, - ); + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + super('DummyERC721Token', DummyERC721TokenContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( DummyERC721TokenContract.ABI(), this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 e7aa2434df..7f54073ecf 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts @@ -1,7 +1,7 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract'; +import { BaseContract,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -23,144 +23,91 @@ import { assert } from '@0x/assert'; import * as ethers from 'ethers'; // tslint:enable:no-unused-variable + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class DutchAuctionContract extends BaseContract { public getAuctionDetails = { async sendTransactionAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - txData?: Partial | undefined, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + txData?: Partial | undefined, ): Promise { - const self = (this as any) as DutchAuctionContract; - const encodedData = self._strictEncodeArguments( - 'getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', - [order], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.getAuctionDetails.estimateGasAsync.bind(self, order), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + + const self = this as any as DutchAuctionContract; + const encodedData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.getAuctionDetails.estimateGasAsync.bind( + self, + order + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - const self = (this as any) as DutchAuctionContract; - const txHashPromise = self.getAuctionDetails.sendTransactionAsync(order, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + + const self = this as any as DutchAuctionContract; + const txHashPromise = self.getAuctionDetails.sendTransactionAsync(order + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, txData?: Partial | undefined, ): Promise { - const self = (this as any) as DutchAuctionContract; - const encodedData = self._strictEncodeArguments( - 'getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', - [order], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + + const self = this as any as DutchAuctionContract; + const encodedData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{ - beginTimeSeconds: BigNumber; - endTimeSeconds: BigNumber; - beginAmount: BigNumber; - endAmount: BigNumber; - currentAmount: BigNumber; - currentTimeSeconds: BigNumber; - }> { + ): Promise<{beginTimeSeconds: BigNumber;endTimeSeconds: BigNumber;beginAmount: BigNumber;endAmount: BigNumber;currentAmount: BigNumber;currentTimeSeconds: BigNumber} + > { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -169,11 +116,9 @@ export class DutchAuctionContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DutchAuctionContract; - const encodedData = self._strictEncodeArguments( - 'getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', - [order], - ); + const self = this as any as DutchAuctionContract; + const encodedData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -182,266 +127,141 @@ export class DutchAuctionContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', - ); + const abiEncoder = self._lookupAbiEncoder('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ - beginTimeSeconds: BigNumber; - endTimeSeconds: BigNumber; - beginAmount: BigNumber; - endAmount: BigNumber; - currentAmount: BigNumber; - currentTimeSeconds: BigNumber; - }>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{beginTimeSeconds: BigNumber;endTimeSeconds: BigNumber;beginAmount: BigNumber;endAmount: BigNumber;currentAmount: BigNumber;currentTimeSeconds: BigNumber} + >(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }): string { - const self = (this as any) as DutchAuctionContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', - [order], - ); + getABIEncodedTransactionData( + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + ): string { + + const self = this as any as DutchAuctionContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order + ]); return abiEncodedTransactionData; }, }; public matchOrders = { async sendTransactionAsync( - buyOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - sellOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, buySignature: string, sellSignature: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('buySignature', buySignature); - assert.isString('sellSignature', sellSignature); - const self = (this as any) as DutchAuctionContract; - const encodedData = self._strictEncodeArguments( - 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', - [buyOrder, sellOrder, buySignature, sellSignature], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.matchOrders.estimateGasAsync.bind(self, buyOrder, sellOrder, buySignature, sellSignature), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + + + assert.isString('buySignature', buySignature); + assert.isString('sellSignature', sellSignature); + const self = this as any as DutchAuctionContract; + const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [buyOrder, + sellOrder, + buySignature, + sellSignature + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.matchOrders.estimateGasAsync.bind( + self, + buyOrder, + sellOrder, + buySignature, + sellSignature + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - buyOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - sellOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, buySignature: string, sellSignature: string, txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('buySignature', buySignature); - assert.isString('sellSignature', sellSignature); - const self = (this as any) as DutchAuctionContract; - const txHashPromise = self.matchOrders.sendTransactionAsync( - buyOrder, - sellOrder, - buySignature, - sellSignature, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + + + assert.isString('buySignature', buySignature); + assert.isString('sellSignature', sellSignature); + const self = this as any as DutchAuctionContract; + const txHashPromise = self.matchOrders.sendTransactionAsync(buyOrder, + sellOrder, + buySignature, + sellSignature + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - buyOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - sellOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, buySignature: string, sellSignature: string, txData?: Partial | undefined, ): Promise { - assert.isString('buySignature', buySignature); - assert.isString('sellSignature', sellSignature); - const self = (this as any) as DutchAuctionContract; - const encodedData = self._strictEncodeArguments( - 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', - [buyOrder, sellOrder, buySignature, sellSignature], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + + + assert.isString('buySignature', buySignature); + assert.isString('sellSignature', sellSignature); + const self = this as any as DutchAuctionContract; + const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [buyOrder, + sellOrder, + buySignature, + sellSignature + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - buyOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - sellOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, buySignature: string, sellSignature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{ - left: { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }; - right: { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }; - leftMakerAssetSpreadAmount: BigNumber; - }> { + ): Promise<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber} + > { + + assert.isString('buySignature', buySignature); assert.isString('sellSignature', sellSignature); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -452,11 +272,12 @@ export class DutchAuctionContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as DutchAuctionContract; - const encodedData = self._strictEncodeArguments( - 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', - [buyOrder, sellOrder, buySignature, sellSignature], - ); + const self = this as any as DutchAuctionContract; + const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [buyOrder, + sellOrder, + buySignature, + sellSignature + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -465,82 +286,42 @@ export class DutchAuctionContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(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)', - ); + const abiEncoder = self._lookupAbiEncoder('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ - left: { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }; - right: { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }; - leftMakerAssetSpreadAmount: BigNumber; - }>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber} + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - buyOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - sellOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - buySignature: string, - sellSignature: string, - ): string { + buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + buySignature: string, + sellSignature: string, + ): string { + + assert.isString('buySignature', buySignature); assert.isString('sellSignature', sellSignature); - const self = (this as any) as DutchAuctionContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', - [buyOrder, sellOrder, buySignature, sellSignature], - ); + const self = this as any as DutchAuctionContract; + const abiEncodedTransactionData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [buyOrder, + sellOrder, + buySignature, + sellSignature + ]); return abiEncodedTransactionData; }, }; - public static async deployFrom0xArtifactAsync( +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, - _exchange: string, + logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + _exchange: string, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -553,18 +334,9 @@ export class DutchAuctionContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); - return DutchAuctionContract.deployAsync( - bytecode, - abi, - provider, - txDefaults, - logDecodeDependenciesAbiOnly, - _exchange, - ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); + return DutchAuctionContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, _exchange +); } public static async deployAsync( bytecode: string, @@ -572,7 +344,7 @@ export class DutchAuctionContract extends BaseContract { supportedProvider: SupportedProvider, txDefaults: Partial, logDecodeDependencies: { [contractName: string]: ContractAbi }, - _exchange: string, + _exchange: string, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -582,17 +354,20 @@ export class DutchAuctionContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_exchange] = BaseContract._formatABIDataItemList( + [_exchange +] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [_exchange], + [_exchange +], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_exchange]); + const txData = deployInfo.encode(bytecode, [_exchange +]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -600,22 +375,19 @@ export class DutchAuctionContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`DutchAuction successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new DutchAuctionContract( - txReceipt.contractAddress as string, - provider, - txDefaults, - logDecodeDependencies, - ); - contractInstance.constructorArgs = [_exchange]; + const contractInstance = new DutchAuctionContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); + contractInstance.constructorArgs = [_exchange +]; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: false, inputs: [ { @@ -670,7 +442,7 @@ export class DutchAuctionContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, ], name: 'getAuctionDetails', @@ -703,14 +475,14 @@ export class DutchAuctionContract extends BaseContract { name: 'currentTimeSeconds', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -765,7 +537,7 @@ export class DutchAuctionContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'sellOrder', @@ -819,7 +591,7 @@ export class DutchAuctionContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'buySignature', @@ -856,7 +628,7 @@ export class DutchAuctionContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, { name: 'right', @@ -878,27 +650,28 @@ export class DutchAuctionContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, { name: 'leftMakerAssetSpreadAmount', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { inputs: [ { name: '_exchange', type: 'address', }, ], - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'constructor', @@ -906,23 +679,11 @@ export class DutchAuctionContract extends BaseContract { ] as ContractAbi; return abi; } - constructor( - address: string, - supportedProvider: SupportedProvider, - txDefaults?: Partial, - logDecodeDependencies?: { [contractName: string]: ContractAbi }, - ) { - super( - 'DutchAuction', - DutchAuctionContract.ABI(), - address, - supportedProvider, - txDefaults, - logDecodeDependencies, - ); + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + super('DutchAuction', DutchAuctionContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 bcfd2f5b1c..e1807954be 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts @@ -1,14 +1,11 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { - BaseContract, +import { BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager, - PromiseWithTransactionHash, -} from '@0x/base-contract'; + SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -50,30 +47,38 @@ export interface ERC20ProxyAuthorizedAddressRemovedEventArgs extends DecodedLogA caller: string; } + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class ERC20ProxyContract extends BaseContract { public addAuthorizedAddress = { - async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.addAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + target: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('target', target); + const self = this as any as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.addAuthorizedAddress.estimateGasAsync.bind( + self, + target.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -81,41 +86,51 @@ export class ERC20ProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = (this as any) as ERC20ProxyContract; - const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + const self = this as any as ERC20ProxyContract; + const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + target: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('target', target); + const self = this as any as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + target: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('target', target); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -125,8 +140,9 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); + const self = this as any as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -135,24 +151,24 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(target: string): string { + getABIEncodedTransactionData( + target: string, + ): string { assert.isString('target', target); - const self = (this as any) as ERC20ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [ - target.toLowerCase(), - ]); + const self = this as any as ERC20ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() + ]); return abiEncodedTransactionData; }, }; @@ -161,7 +177,8 @@ export class ERC20ProxyContract extends BaseContract { index_0: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -171,8 +188,9 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0]); + const self = this as any as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0 + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -181,45 +199,54 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: BigNumber): string { + getABIEncodedTransactionData( + index_0: BigNumber, + ): string { assert.isBigNumber('index_0', index_0); - const self = (this as any) as ERC20ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('authorities(uint256)', [index_0]); + const self = this as any as ERC20ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('authorities(uint256)', [index_0 + ]); return abiEncodedTransactionData; }, }; public removeAuthorizedAddress = { - async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + target: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('target', target); + const self = this as any as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeAuthorizedAddress.estimateGasAsync.bind( + self, + target.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -227,41 +254,51 @@ export class ERC20ProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = (this as any) as ERC20ProxyContract; - const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + const self = this as any as ERC20ProxyContract; + const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + target: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('target', target); + const self = this as any as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + target: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('target', target); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -271,8 +308,9 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); + const self = this as any as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -281,29 +319,33 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(target: string): string { + getABIEncodedTransactionData( + target: string, + ): string { assert.isString('target', target); - const self = (this as any) as ERC20ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [ - target.toLowerCase(), - ]); + const self = this as any as ERC20ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public owner = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -312,7 +354,7 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC20ProxyContract; + const self = this as any as ERC20ProxyContract; const encodedData = self._strictEncodeArguments('owner()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -322,20 +364,20 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as ERC20ProxyContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as ERC20ProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); return abiEncodedTransactionData; }, @@ -344,30 +386,33 @@ export class ERC20ProxyContract extends BaseContract { async sendTransactionAsync( target: string, index: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = this as any as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), + index + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind( + self, target.toLowerCase(), - index, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(self, target.toLowerCase(), index), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + index + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -376,59 +421,57 @@ export class ERC20ProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as ERC20ProxyContract; - const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync( - target.toLowerCase(), - index, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = this as any as ERC20ProxyContract; + const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync(target.toLowerCase(), + index + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( target: string, index: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target.toLowerCase(), - index, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = this as any as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), + index + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( target: string, index: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('target', target); assert.isBigNumber('index', index); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -439,11 +482,10 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target.toLowerCase(), - index, - ]); + const self = this as any as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), + index + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -452,31 +494,36 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(target: string, index: BigNumber): string { + getABIEncodedTransactionData( + target: string, + index: BigNumber, + ): string { assert.isString('target', target); assert.isBigNumber('index', index); - const self = (this as any) as ERC20ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'removeAuthorizedAddressAtIndex(address,uint256)', - [target.toLowerCase(), index], - ); + const self = this as any as ERC20ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), + index + ]); return abiEncodedTransactionData; }, }; public getProxyId = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -485,7 +532,7 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC20ProxyContract; + const self = this as any as ERC20ProxyContract; const encodedData = self._strictEncodeArguments('getProxyId()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -495,20 +542,20 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getProxyId()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as ERC20ProxyContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as ERC20ProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('getProxyId()', []); return abiEncodedTransactionData; }, @@ -518,7 +565,8 @@ export class ERC20ProxyContract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -528,8 +576,9 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase()]); + const self = this as any as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -538,29 +587,33 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorized(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: string): string { + getABIEncodedTransactionData( + index_0: string, + ): string { assert.isString('index_0', index_0); - const self = (this as any) as ERC20ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [ - index_0.toLowerCase(), - ]); + const self = this as any as ERC20ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public getAuthorizedAddresses = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -569,7 +622,7 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC20ProxyContract; + const self = this as any as ERC20ProxyContract; const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -579,44 +632,51 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as ERC20ProxyContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as ERC20ProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('getAuthorizedAddresses()', []); return abiEncodedTransactionData; }, }; public transferOwnership = { - async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + newOwner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('newOwner', newOwner); + const self = this as any as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferOwnership.estimateGasAsync.bind( + self, + newOwner.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( newOwner: string, @@ -624,41 +684,51 @@ export class ERC20ProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('newOwner', newOwner); - const self = (this as any) as ERC20ProxyContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('newOwner', newOwner); + const self = this as any as ERC20ProxyContract; + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + newOwner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('newOwner', newOwner); + const self = this as any as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + newOwner: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -668,8 +738,9 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const self = this as any as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -678,33 +749,33 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(newOwner: string): string { + getABIEncodedTransactionData( + newOwner: string, + ): string { assert.isString('newOwner', newOwner); - const self = (this as any) as ERC20ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ - newOwner.toLowerCase(), - ]); + const self = this as any as ERC20ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); return abiEncodedTransactionData; }, }; - private readonly _subscriptionManager: SubscriptionManager; - public static async deployFrom0xArtifactAsync( +private readonly _subscriptionManager: SubscriptionManager; +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -717,11 +788,8 @@ export class ERC20ProxyContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); - return ERC20ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); + return ERC20ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, ); } public static async deployAsync( bytecode: string, @@ -738,13 +806,17 @@ export class ERC20ProxyContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); + [] = BaseContract._formatABIDataItemList( + constructorAbi.inputs, + [], + BaseContract._bigNumberToString, + ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -752,22 +824,18 @@ export class ERC20ProxyContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`ERC20Proxy successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ERC20ProxyContract( - txReceipt.contractAddress as string, - provider, - txDefaults, - logDecodeDependencies, - ); + const contractInstance = new ERC20ProxyContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); contractInstance.constructorArgs = []; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: false, inputs: [ { @@ -776,12 +844,13 @@ export class ERC20ProxyContract extends BaseContract { }, ], name: 'addAuthorizedAddress', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -800,7 +869,7 @@ export class ERC20ProxyContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -809,14 +878,16 @@ export class ERC20ProxyContract extends BaseContract { }, ], name: 'removeAuthorizedAddress', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'owner', outputs: [ { @@ -828,7 +899,7 @@ export class ERC20ProxyContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -841,14 +912,16 @@ export class ERC20ProxyContract extends BaseContract { }, ], name: 'removeAuthorizedAddressAtIndex', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'getProxyId', outputs: [ { @@ -860,7 +933,7 @@ export class ERC20ProxyContract extends BaseContract { stateMutability: 'pure', type: 'function', }, - { + { constant: true, inputs: [ { @@ -879,9 +952,10 @@ export class ERC20ProxyContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'getAuthorizedAddresses', outputs: [ { @@ -893,7 +967,7 @@ export class ERC20ProxyContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -902,19 +976,22 @@ export class ERC20ProxyContract extends BaseContract { }, ], name: 'transferOwnership', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { - inputs: [], - outputs: [], + { + inputs: [ + ], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'fallback', }, - { + { anonymous: false, inputs: [ { @@ -929,10 +1006,11 @@ export class ERC20ProxyContract extends BaseContract { }, ], name: 'AuthorizedAddressAdded', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -947,7 +1025,8 @@ export class ERC20ProxyContract extends BaseContract { }, ], name: 'AuthorizedAddressRemoved', - outputs: [], + outputs: [ + ], type: 'event', }, ] as ContractAbi; @@ -1021,12 +1100,7 @@ export class ERC20ProxyContract extends BaseContract { ); return logs; } - constructor( - address: string, - supportedProvider: SupportedProvider, - txDefaults?: Partial, - logDecodeDependencies?: { [contractName: string]: ContractAbi }, - ) { + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { super('ERC20Proxy', ERC20ProxyContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( @@ -1034,7 +1108,7 @@ export class ERC20ProxyContract extends BaseContract { this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 58b2815bc4..5599c751f4 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts @@ -1,14 +1,11 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { - BaseContract, +import { BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager, - PromiseWithTransactionHash, -} from '@0x/base-contract'; + SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -31,7 +28,9 @@ import { assert } from '@0x/assert'; import * as ethers from 'ethers'; // tslint:enable:no-unused-variable -export type ERC20TokenEventArgs = ERC20TokenTransferEventArgs | ERC20TokenApprovalEventArgs; +export type ERC20TokenEventArgs = + | ERC20TokenTransferEventArgs + | ERC20TokenApprovalEventArgs; export enum ERC20TokenEvents { Transfer = 'Transfer', @@ -50,6 +49,7 @@ export interface ERC20TokenApprovalEventArgs extends DecodedLogArgs { _value: BigNumber; } + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name @@ -58,30 +58,33 @@ export class ERC20TokenContract extends BaseContract { async sendTransactionAsync( _spender: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = (this as any) as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = this as any as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.approve.estimateGasAsync.bind( + self, _spender.toLowerCase(), - _value, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind(self, _spender.toLowerCase(), _value), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _value + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _spender: string, @@ -90,55 +93,57 @@ export class ERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = (this as any) as ERC20TokenContract; - const txHashPromise = self.approve.sendTransactionAsync(_spender.toLowerCase(), _value, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = this as any as ERC20TokenContract; + const txHashPromise = self.approve.sendTransactionAsync(_spender.toLowerCase(), + _value + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _spender: string, _value: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = (this as any) as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ - _spender.toLowerCase(), - _value, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = this as any as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _spender: string, _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -149,11 +154,10 @@ export class ERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ - _spender.toLowerCase(), - _value, - ]); + const self = this as any as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), + _value + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -162,31 +166,36 @@ export class ERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_spender: string, _value: BigNumber): string { + getABIEncodedTransactionData( + _spender: string, + _value: BigNumber, + ): string { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); - const self = (this as any) as ERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [ - _spender.toLowerCase(), - _value, - ]); + const self = this as any as ERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), + _value + ]); return abiEncodedTransactionData; }, }; public totalSupply = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -195,7 +204,7 @@ export class ERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC20TokenContract; + const self = this as any as ERC20TokenContract; const encodedData = self._strictEncodeArguments('totalSupply()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -205,20 +214,20 @@ export class ERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('totalSupply()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as ERC20TokenContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as ERC20TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('totalSupply()', []); return abiEncodedTransactionData; }, @@ -228,32 +237,36 @@ export class ERC20TokenContract extends BaseContract { _from: string, _to: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferFrom.estimateGasAsync.bind( + self, _from.toLowerCase(), _to.toLowerCase(), - _value, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _value), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _value + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -263,27 +276,25 @@ export class ERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as ERC20TokenContract; - const txHashPromise = self.transferFrom.sendTransactionAsync( - _from.toLowerCase(), - _to.toLowerCase(), - _value, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as ERC20TokenContract; + const txHashPromise = self.transferFrom.sendTransactionAsync(_from.toLowerCase(), + _to.toLowerCase(), + _value + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -291,29 +302,28 @@ export class ERC20TokenContract extends BaseContract { _value: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _value, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -321,7 +331,8 @@ export class ERC20TokenContract extends BaseContract { _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_value', _value); @@ -333,12 +344,11 @@ export class ERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _value, - ]); + const self = this as any as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _value + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -347,28 +357,30 @@ export class ERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_from: string, _to: string, _value: BigNumber): string { + getABIEncodedTransactionData( + _from: string, + _to: string, + _value: BigNumber, + ): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_value', _value); - const self = (this as any) as ERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _value, - ]); + const self = this as any as ERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _value + ]); return abiEncodedTransactionData; }, }; @@ -377,7 +389,8 @@ export class ERC20TokenContract extends BaseContract { _owner: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -387,8 +400,9 @@ export class ERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); + const self = this as any as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -397,22 +411,24 @@ export class ERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_owner: string): string { + getABIEncodedTransactionData( + _owner: string, + ): string { assert.isString('_owner', _owner); - const self = (this as any) as ERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); + const self = this as any as ERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() + ]); return abiEncodedTransactionData; }, }; @@ -420,27 +436,33 @@ export class ERC20TokenContract extends BaseContract { async sendTransactionAsync( _to: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transfer.estimateGasAsync.bind(self, _to.toLowerCase(), _value), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transfer.estimateGasAsync.bind( + self, + _to.toLowerCase(), + _value + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _to: string, @@ -449,48 +471,57 @@ export class ERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as ERC20TokenContract; - const txHashPromise = self.transfer.sendTransactionAsync(_to.toLowerCase(), _value, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as ERC20TokenContract; + const txHashPromise = self.transfer.sendTransactionAsync(_to.toLowerCase(), + _value + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(_to: string, _value: BigNumber, txData?: Partial | undefined): Promise { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + _to: string, + _value: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _to: string, _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_to', _to); assert.isBigNumber('_value', _value); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -501,8 +532,10 @@ export class ERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); + const self = this as any as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), + _value + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -511,26 +544,27 @@ export class ERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_to: string, _value: BigNumber): string { + getABIEncodedTransactionData( + _to: string, + _value: BigNumber, + ): string { assert.isString('_to', _to); assert.isBigNumber('_value', _value); - const self = (this as any) as ERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [ - _to.toLowerCase(), - _value, - ]); + const self = this as any as ERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), + _value + ]); return abiEncodedTransactionData; }, }; @@ -540,7 +574,8 @@ export class ERC20TokenContract extends BaseContract { _spender: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.isString('_spender', _spender); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -551,11 +586,10 @@ export class ERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('allowance(address,address)', [ - _owner.toLowerCase(), - _spender.toLowerCase(), - ]); + const self = this as any as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('allowance(address,address)', [_owner.toLowerCase(), + _spender.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -564,35 +598,36 @@ export class ERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_owner: string, _spender: string): string { + getABIEncodedTransactionData( + _owner: string, + _spender: string, + ): string { assert.isString('_owner', _owner); assert.isString('_spender', _spender); - const self = (this as any) as ERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [ - _owner.toLowerCase(), - _spender.toLowerCase(), - ]); + const self = this as any as ERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [_owner.toLowerCase(), + _spender.toLowerCase() + ]); return abiEncodedTransactionData; }, }; - private readonly _subscriptionManager: SubscriptionManager; - public static async deployFrom0xArtifactAsync( +private readonly _subscriptionManager: SubscriptionManager; +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -605,11 +640,8 @@ export class ERC20TokenContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); - return ERC20TokenContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); + return ERC20TokenContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, ); } public static async deployAsync( bytecode: string, @@ -626,13 +658,17 @@ export class ERC20TokenContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); + [] = BaseContract._formatABIDataItemList( + constructorAbi.inputs, + [], + BaseContract._bigNumberToString, + ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -640,22 +676,18 @@ export class ERC20TokenContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`ERC20Token successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ERC20TokenContract( - txReceipt.contractAddress as string, - provider, - txDefaults, - logDecodeDependencies, - ); + const contractInstance = new ERC20TokenContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); contractInstance.constructorArgs = []; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: false, inputs: [ { @@ -678,9 +710,10 @@ export class ERC20TokenContract extends BaseContract { stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'totalSupply', outputs: [ { @@ -692,7 +725,7 @@ export class ERC20TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -719,7 +752,7 @@ export class ERC20TokenContract extends BaseContract { stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -738,7 +771,7 @@ export class ERC20TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -761,7 +794,7 @@ export class ERC20TokenContract extends BaseContract { stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -784,7 +817,7 @@ export class ERC20TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { anonymous: false, inputs: [ { @@ -804,10 +837,11 @@ export class ERC20TokenContract extends BaseContract { }, ], name: 'Transfer', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -827,7 +861,8 @@ export class ERC20TokenContract extends BaseContract { }, ], name: 'Approval', - outputs: [], + outputs: [ + ], type: 'event', }, ] as ContractAbi; @@ -901,12 +936,7 @@ export class ERC20TokenContract extends BaseContract { ); return logs; } - constructor( - address: string, - supportedProvider: SupportedProvider, - txDefaults?: Partial, - logDecodeDependencies?: { [contractName: string]: ContractAbi }, - ) { + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { super('ERC20Token', ERC20TokenContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( @@ -914,7 +944,7 @@ export class ERC20TokenContract extends BaseContract { this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 ee5085d4ab..829d8b8469 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts @@ -1,14 +1,11 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { - BaseContract, +import { BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager, - PromiseWithTransactionHash, -} from '@0x/base-contract'; + SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -50,30 +47,38 @@ export interface ERC721ProxyAuthorizedAddressRemovedEventArgs extends DecodedLog caller: string; } + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class ERC721ProxyContract extends BaseContract { public addAuthorizedAddress = { - async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.addAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + target: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('target', target); + const self = this as any as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.addAuthorizedAddress.estimateGasAsync.bind( + self, + target.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -81,41 +86,51 @@ export class ERC721ProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = (this as any) as ERC721ProxyContract; - const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + const self = this as any as ERC721ProxyContract; + const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + target: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('target', target); + const self = this as any as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + target: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('target', target); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -125,8 +140,9 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); + const self = this as any as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -135,24 +151,24 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(target: string): string { + getABIEncodedTransactionData( + target: string, + ): string { assert.isString('target', target); - const self = (this as any) as ERC721ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [ - target.toLowerCase(), - ]); + const self = this as any as ERC721ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() + ]); return abiEncodedTransactionData; }, }; @@ -161,7 +177,8 @@ export class ERC721ProxyContract extends BaseContract { index_0: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -171,8 +188,9 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0]); + const self = this as any as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0 + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -181,45 +199,54 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: BigNumber): string { + getABIEncodedTransactionData( + index_0: BigNumber, + ): string { assert.isBigNumber('index_0', index_0); - const self = (this as any) as ERC721ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('authorities(uint256)', [index_0]); + const self = this as any as ERC721ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('authorities(uint256)', [index_0 + ]); return abiEncodedTransactionData; }, }; public removeAuthorizedAddress = { - async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + target: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('target', target); + const self = this as any as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeAuthorizedAddress.estimateGasAsync.bind( + self, + target.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -227,41 +254,51 @@ export class ERC721ProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = (this as any) as ERC721ProxyContract; - const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + const self = this as any as ERC721ProxyContract; + const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + target: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('target', target); + const self = this as any as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + target: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('target', target); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -271,8 +308,9 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); + const self = this as any as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -281,29 +319,33 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(target: string): string { + getABIEncodedTransactionData( + target: string, + ): string { assert.isString('target', target); - const self = (this as any) as ERC721ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [ - target.toLowerCase(), - ]); + const self = this as any as ERC721ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public owner = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -312,7 +354,7 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721ProxyContract; + const self = this as any as ERC721ProxyContract; const encodedData = self._strictEncodeArguments('owner()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -322,20 +364,20 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as ERC721ProxyContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as ERC721ProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); return abiEncodedTransactionData; }, @@ -344,30 +386,33 @@ export class ERC721ProxyContract extends BaseContract { async sendTransactionAsync( target: string, index: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = this as any as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), + index + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind( + self, target.toLowerCase(), - index, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(self, target.toLowerCase(), index), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + index + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -376,59 +421,57 @@ export class ERC721ProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as ERC721ProxyContract; - const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync( - target.toLowerCase(), - index, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = this as any as ERC721ProxyContract; + const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync(target.toLowerCase(), + index + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( target: string, index: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target.toLowerCase(), - index, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = this as any as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), + index + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( target: string, index: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('target', target); assert.isBigNumber('index', index); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -439,11 +482,10 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target.toLowerCase(), - index, - ]); + const self = this as any as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), + index + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -452,31 +494,36 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(target: string, index: BigNumber): string { + getABIEncodedTransactionData( + target: string, + index: BigNumber, + ): string { assert.isString('target', target); assert.isBigNumber('index', index); - const self = (this as any) as ERC721ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'removeAuthorizedAddressAtIndex(address,uint256)', - [target.toLowerCase(), index], - ); + const self = this as any as ERC721ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), + index + ]); return abiEncodedTransactionData; }, }; public getProxyId = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -485,7 +532,7 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721ProxyContract; + const self = this as any as ERC721ProxyContract; const encodedData = self._strictEncodeArguments('getProxyId()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -495,20 +542,20 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getProxyId()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as ERC721ProxyContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as ERC721ProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('getProxyId()', []); return abiEncodedTransactionData; }, @@ -518,7 +565,8 @@ export class ERC721ProxyContract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -528,8 +576,9 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase()]); + const self = this as any as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -538,29 +587,33 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorized(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: string): string { + getABIEncodedTransactionData( + index_0: string, + ): string { assert.isString('index_0', index_0); - const self = (this as any) as ERC721ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [ - index_0.toLowerCase(), - ]); + const self = this as any as ERC721ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public getAuthorizedAddresses = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -569,7 +622,7 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721ProxyContract; + const self = this as any as ERC721ProxyContract; const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -579,44 +632,51 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as ERC721ProxyContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as ERC721ProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('getAuthorizedAddresses()', []); return abiEncodedTransactionData; }, }; public transferOwnership = { - async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + newOwner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('newOwner', newOwner); + const self = this as any as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferOwnership.estimateGasAsync.bind( + self, + newOwner.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( newOwner: string, @@ -624,41 +684,51 @@ export class ERC721ProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('newOwner', newOwner); - const self = (this as any) as ERC721ProxyContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('newOwner', newOwner); + const self = this as any as ERC721ProxyContract; + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + newOwner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('newOwner', newOwner); + const self = this as any as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + newOwner: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -668,8 +738,9 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const self = this as any as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -678,33 +749,33 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(newOwner: string): string { + getABIEncodedTransactionData( + newOwner: string, + ): string { assert.isString('newOwner', newOwner); - const self = (this as any) as ERC721ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ - newOwner.toLowerCase(), - ]); + const self = this as any as ERC721ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); return abiEncodedTransactionData; }, }; - private readonly _subscriptionManager: SubscriptionManager; - public static async deployFrom0xArtifactAsync( +private readonly _subscriptionManager: SubscriptionManager; +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -717,11 +788,8 @@ export class ERC721ProxyContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); - return ERC721ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); + return ERC721ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, ); } public static async deployAsync( bytecode: string, @@ -738,13 +806,17 @@ export class ERC721ProxyContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); + [] = BaseContract._formatABIDataItemList( + constructorAbi.inputs, + [], + BaseContract._bigNumberToString, + ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -752,22 +824,18 @@ export class ERC721ProxyContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`ERC721Proxy successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ERC721ProxyContract( - txReceipt.contractAddress as string, - provider, - txDefaults, - logDecodeDependencies, - ); + const contractInstance = new ERC721ProxyContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); contractInstance.constructorArgs = []; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: false, inputs: [ { @@ -776,12 +844,13 @@ export class ERC721ProxyContract extends BaseContract { }, ], name: 'addAuthorizedAddress', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -800,7 +869,7 @@ export class ERC721ProxyContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -809,14 +878,16 @@ export class ERC721ProxyContract extends BaseContract { }, ], name: 'removeAuthorizedAddress', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'owner', outputs: [ { @@ -828,7 +899,7 @@ export class ERC721ProxyContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -841,14 +912,16 @@ export class ERC721ProxyContract extends BaseContract { }, ], name: 'removeAuthorizedAddressAtIndex', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'getProxyId', outputs: [ { @@ -860,7 +933,7 @@ export class ERC721ProxyContract extends BaseContract { stateMutability: 'pure', type: 'function', }, - { + { constant: true, inputs: [ { @@ -879,9 +952,10 @@ export class ERC721ProxyContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'getAuthorizedAddresses', outputs: [ { @@ -893,7 +967,7 @@ export class ERC721ProxyContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -902,19 +976,22 @@ export class ERC721ProxyContract extends BaseContract { }, ], name: 'transferOwnership', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { - inputs: [], - outputs: [], + { + inputs: [ + ], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'fallback', }, - { + { anonymous: false, inputs: [ { @@ -929,10 +1006,11 @@ export class ERC721ProxyContract extends BaseContract { }, ], name: 'AuthorizedAddressAdded', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -947,7 +1025,8 @@ export class ERC721ProxyContract extends BaseContract { }, ], name: 'AuthorizedAddressRemoved', - outputs: [], + outputs: [ + ], type: 'event', }, ] as ContractAbi; @@ -1021,12 +1100,7 @@ export class ERC721ProxyContract extends BaseContract { ); return logs; } - constructor( - address: string, - supportedProvider: SupportedProvider, - txDefaults?: Partial, - logDecodeDependencies?: { [contractName: string]: ContractAbi }, - ) { + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { super('ERC721Proxy', ERC721ProxyContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( @@ -1034,7 +1108,7 @@ export class ERC721ProxyContract extends BaseContract { this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 2a0420e010..fe4a3ebfac 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts @@ -1,14 +1,11 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { - BaseContract, +import { BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager, - PromiseWithTransactionHash, -} from '@0x/base-contract'; + SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -60,6 +57,7 @@ export interface ERC721TokenApprovalForAllEventArgs extends DecodedLogArgs { _approved: boolean; } + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name @@ -69,7 +67,8 @@ export class ERC721TokenContract extends BaseContract { _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('_tokenId', _tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -79,8 +78,9 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId]); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -89,22 +89,24 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getApproved(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_tokenId: BigNumber): string { + getABIEncodedTransactionData( + _tokenId: BigNumber, + ): string { assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId]); + const self = this as any as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId + ]); return abiEncodedTransactionData; }, }; @@ -112,30 +114,33 @@ export class ERC721TokenContract extends BaseContract { async sendTransactionAsync( _approved: string, _tokenId: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_approved', _approved); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + assert.isString('_approved', _approved); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(), + _tokenId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.approve.estimateGasAsync.bind( + self, _approved.toLowerCase(), - _tokenId, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind(self, _approved.toLowerCase(), _tokenId), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _tokenId + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _approved: string, @@ -144,55 +149,57 @@ export class ERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_approved', _approved); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as ERC721TokenContract; - const txHashPromise = self.approve.sendTransactionAsync(_approved.toLowerCase(), _tokenId, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_approved', _approved); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as ERC721TokenContract; + const txHashPromise = self.approve.sendTransactionAsync(_approved.toLowerCase(), + _tokenId + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _approved: string, _tokenId: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_approved', _approved); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ - _approved.toLowerCase(), - _tokenId, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_approved', _approved); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(), + _tokenId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _approved: string, _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_approved', _approved); assert.isBigNumber('_tokenId', _tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -203,11 +210,10 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ - _approved.toLowerCase(), - _tokenId, - ]); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(), + _tokenId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -216,26 +222,27 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_approved: string, _tokenId: BigNumber): string { + getABIEncodedTransactionData( + _approved: string, + _tokenId: BigNumber, + ): string { assert.isString('_approved', _approved); assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [ - _approved.toLowerCase(), - _tokenId, - ]); + const self = this as any as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(), + _tokenId + ]); return abiEncodedTransactionData; }, }; @@ -244,32 +251,36 @@ export class ERC721TokenContract extends BaseContract { _from: string, _to: string, _tokenId: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferFrom.estimateGasAsync.bind( + self, _from.toLowerCase(), _to.toLowerCase(), - _tokenId, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _tokenId), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _tokenId + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -279,27 +290,25 @@ export class ERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as ERC721TokenContract; - const txHashPromise = self.transferFrom.sendTransactionAsync( - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as ERC721TokenContract; + const txHashPromise = self.transferFrom.sendTransactionAsync(_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -307,29 +316,28 @@ export class ERC721TokenContract extends BaseContract { _tokenId: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -337,7 +345,8 @@ export class ERC721TokenContract extends BaseContract { _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); @@ -349,12 +358,11 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - ]); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -363,28 +371,30 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_from: string, _to: string, _tokenId: BigNumber): string { + getABIEncodedTransactionData( + _from: string, + _to: string, + _tokenId: BigNumber, + ): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - ]); + const self = this as any as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + ]); return abiEncodedTransactionData; }, }; @@ -393,32 +403,36 @@ export class ERC721TokenContract extends BaseContract { _from: string, _to: string, _tokenId: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.safeTransferFrom1.estimateGasAsync.bind( + self, _from.toLowerCase(), _to.toLowerCase(), - _tokenId, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.safeTransferFrom1.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _tokenId), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _tokenId + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -428,27 +442,25 @@ export class ERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as ERC721TokenContract; - const txHashPromise = self.safeTransferFrom1.sendTransactionAsync( - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as ERC721TokenContract; + const txHashPromise = self.safeTransferFrom1.sendTransactionAsync(_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -456,29 +468,28 @@ export class ERC721TokenContract extends BaseContract { _tokenId: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -486,7 +497,8 @@ export class ERC721TokenContract extends BaseContract { _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); @@ -498,12 +510,11 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - ]); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -512,28 +523,30 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_from: string, _to: string, _tokenId: BigNumber): string { + getABIEncodedTransactionData( + _from: string, + _to: string, + _tokenId: BigNumber, + ): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - ]); + const self = this as any as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId + ]); return abiEncodedTransactionData; }, }; @@ -542,7 +555,8 @@ export class ERC721TokenContract extends BaseContract { _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('_tokenId', _tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -552,8 +566,9 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId]); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -562,22 +577,24 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('ownerOf(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_tokenId: BigNumber): string { + getABIEncodedTransactionData( + _tokenId: BigNumber, + ): string { assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId]); + const self = this as any as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId + ]); return abiEncodedTransactionData; }, }; @@ -586,7 +603,8 @@ export class ERC721TokenContract extends BaseContract { _owner: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -596,8 +614,9 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -606,22 +625,24 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_owner: string): string { + getABIEncodedTransactionData( + _owner: string, + ): string { assert.isString('_owner', _owner); - const self = (this as any) as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); + const self = this as any as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() + ]); return abiEncodedTransactionData; }, }; @@ -629,30 +650,33 @@ export class ERC721TokenContract extends BaseContract { async sendTransactionAsync( _operator: string, _approved: boolean, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_operator', _operator); - assert.isBoolean('_approved', _approved); - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ + assert.isString('_operator', _operator); + assert.isBoolean('_approved', _approved); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(), + _approved + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.setApprovalForAll.estimateGasAsync.bind( + self, _operator.toLowerCase(), - _approved, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.setApprovalForAll.estimateGasAsync.bind(self, _operator.toLowerCase(), _approved), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _approved + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _operator: string, @@ -661,59 +685,57 @@ export class ERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_operator', _operator); - assert.isBoolean('_approved', _approved); - const self = (this as any) as ERC721TokenContract; - const txHashPromise = self.setApprovalForAll.sendTransactionAsync( - _operator.toLowerCase(), - _approved, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_operator', _operator); + assert.isBoolean('_approved', _approved); + const self = this as any as ERC721TokenContract; + const txHashPromise = self.setApprovalForAll.sendTransactionAsync(_operator.toLowerCase(), + _approved + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _operator: string, _approved: boolean, txData?: Partial | undefined, ): Promise { - assert.isString('_operator', _operator); - assert.isBoolean('_approved', _approved); - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ - _operator.toLowerCase(), - _approved, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_operator', _operator); + assert.isBoolean('_approved', _approved); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(), + _approved + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _operator: string, _approved: boolean, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_operator', _operator); assert.isBoolean('_approved', _approved); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -724,11 +746,10 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ - _operator.toLowerCase(), - _approved, - ]); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(), + _approved + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -737,26 +758,27 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_operator: string, _approved: boolean): string { + getABIEncodedTransactionData( + _operator: string, + _approved: boolean, + ): string { assert.isString('_operator', _operator); assert.isBoolean('_approved', _approved); - const self = (this as any) as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ - _operator.toLowerCase(), - _approved, - ]); + const self = this as any as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(), + _approved + ]); return abiEncodedTransactionData; }, }; @@ -766,40 +788,39 @@ export class ERC721TokenContract extends BaseContract { _to: string, _tokenId: BigNumber, _data: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - assert.isString('_data', _data); - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [ + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + assert.isString('_data', _data); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.safeTransferFrom2.estimateGasAsync.bind( + self, _from.toLowerCase(), _to.toLowerCase(), _tokenId, - _data, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.safeTransferFrom2.estimateGasAsync.bind( - self, - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data, - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _data + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -810,29 +831,27 @@ export class ERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - assert.isString('_data', _data); - const self = (this as any) as ERC721TokenContract; - const txHashPromise = self.safeTransferFrom2.sendTransactionAsync( - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + assert.isString('_data', _data); + const self = this as any as ERC721TokenContract; + const txHashPromise = self.safeTransferFrom2.sendTransactionAsync(_from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -841,31 +860,30 @@ export class ERC721TokenContract extends BaseContract { _data: string, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - assert.isString('_data', _data); - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + assert.isString('_data', _data); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -874,7 +892,8 @@ export class ERC721TokenContract extends BaseContract { _data: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); @@ -887,13 +906,12 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data, - ]); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -902,28 +920,33 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_from: string, _to: string, _tokenId: BigNumber, _data: string): string { + getABIEncodedTransactionData( + _from: string, + _to: string, + _tokenId: BigNumber, + _data: string, + ): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); assert.isString('_data', _data); - const self = (this as any) as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'safeTransferFrom(address,address,uint256,bytes)', - [_from.toLowerCase(), _to.toLowerCase(), _tokenId, _data], - ); + const self = this as any as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data + ]); return abiEncodedTransactionData; }, }; @@ -933,7 +956,8 @@ export class ERC721TokenContract extends BaseContract { _operator: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.isString('_operator', _operator); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -944,11 +968,10 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('isApprovedForAll(address,address)', [ - _owner.toLowerCase(), - _operator.toLowerCase(), - ]); + const self = this as any as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('isApprovedForAll(address,address)', [_owner.toLowerCase(), + _operator.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -957,35 +980,36 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isApprovedForAll(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_owner: string, _operator: string): string { + getABIEncodedTransactionData( + _owner: string, + _operator: string, + ): string { assert.isString('_owner', _owner); assert.isString('_operator', _operator); - const self = (this as any) as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('isApprovedForAll(address,address)', [ - _owner.toLowerCase(), - _operator.toLowerCase(), - ]); + const self = this as any as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isApprovedForAll(address,address)', [_owner.toLowerCase(), + _operator.toLowerCase() + ]); return abiEncodedTransactionData; }, }; - private readonly _subscriptionManager: SubscriptionManager; - public static async deployFrom0xArtifactAsync( +private readonly _subscriptionManager: SubscriptionManager; +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -998,11 +1022,8 @@ export class ERC721TokenContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); - return ERC721TokenContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); + return ERC721TokenContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, ); } public static async deployAsync( bytecode: string, @@ -1019,13 +1040,17 @@ export class ERC721TokenContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); + [] = BaseContract._formatABIDataItemList( + constructorAbi.inputs, + [], + BaseContract._bigNumberToString, + ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -1033,22 +1058,18 @@ export class ERC721TokenContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`ERC721Token successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ERC721TokenContract( - txReceipt.contractAddress as string, - provider, - txDefaults, - logDecodeDependencies, - ); + const contractInstance = new ERC721TokenContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); contractInstance.constructorArgs = []; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -1067,7 +1088,7 @@ export class ERC721TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1080,12 +1101,13 @@ export class ERC721TokenContract extends BaseContract { }, ], name: 'approve', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1102,12 +1124,13 @@ export class ERC721TokenContract extends BaseContract { }, ], name: 'transferFrom', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1124,12 +1147,13 @@ export class ERC721TokenContract extends BaseContract { }, ], name: 'safeTransferFrom', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1148,7 +1172,7 @@ export class ERC721TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1167,7 +1191,7 @@ export class ERC721TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1180,12 +1204,13 @@ export class ERC721TokenContract extends BaseContract { }, ], name: 'setApprovalForAll', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1206,12 +1231,13 @@ export class ERC721TokenContract extends BaseContract { }, ], name: 'safeTransferFrom', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1234,7 +1260,7 @@ export class ERC721TokenContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { anonymous: false, inputs: [ { @@ -1254,10 +1280,11 @@ export class ERC721TokenContract extends BaseContract { }, ], name: 'Transfer', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1277,10 +1304,11 @@ export class ERC721TokenContract extends BaseContract { }, ], name: 'Approval', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1300,7 +1328,8 @@ export class ERC721TokenContract extends BaseContract { }, ], name: 'ApprovalForAll', - outputs: [], + outputs: [ + ], type: 'event', }, ] as ContractAbi; @@ -1374,12 +1403,7 @@ export class ERC721TokenContract extends BaseContract { ); return logs; } - constructor( - address: string, - supportedProvider: SupportedProvider, - txDefaults?: Partial, - logDecodeDependencies?: { [contractName: string]: ContractAbi }, - ) { + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { super('ERC721Token', ERC721TokenContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( @@ -1387,7 +1411,7 @@ export class ERC721TokenContract extends BaseContract { this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 e4a6c2ac39..bc77e5c9b0 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 @@ -1,7 +1,7 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract'; +import { BaseContract,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -23,6 +23,7 @@ import { assert } from '@0x/assert'; import * as ethers from 'ethers'; // tslint:enable:no-unused-variable + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name @@ -32,7 +33,8 @@ export class EthBalanceCheckerContract extends BaseContract { addresses: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isArray('addresses', addresses); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -42,8 +44,9 @@ export class EthBalanceCheckerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as EthBalanceCheckerContract; - const encodedData = self._strictEncodeArguments('getEthBalances(address[])', [addresses]); + const self = this as any as EthBalanceCheckerContract; + const encodedData = self._strictEncodeArguments('getEthBalances(address[])', [addresses + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -52,30 +55,32 @@ export class EthBalanceCheckerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getEthBalances(address[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(addresses: string[]): string { + getABIEncodedTransactionData( + addresses: string[], + ): string { assert.isArray('addresses', addresses); - const self = (this as any) as EthBalanceCheckerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getEthBalances(address[])', [addresses]); + const self = this as any as EthBalanceCheckerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getEthBalances(address[])', [addresses + ]); return abiEncodedTransactionData; }, }; - public static async deployFrom0xArtifactAsync( +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -88,11 +93,8 @@ export class EthBalanceCheckerContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); - return EthBalanceCheckerContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); + return EthBalanceCheckerContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, ); } public static async deployAsync( bytecode: string, @@ -109,13 +111,17 @@ export class EthBalanceCheckerContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); + [] = BaseContract._formatABIDataItemList( + constructorAbi.inputs, + [], + BaseContract._bigNumberToString, + ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -123,22 +129,18 @@ export class EthBalanceCheckerContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`EthBalanceChecker successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new EthBalanceCheckerContract( - txReceipt.contractAddress as string, - provider, - txDefaults, - logDecodeDependencies, - ); + const contractInstance = new EthBalanceCheckerContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); contractInstance.constructorArgs = []; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -160,23 +162,11 @@ export class EthBalanceCheckerContract extends BaseContract { ] as ContractAbi; return abi; } - constructor( - address: string, - supportedProvider: SupportedProvider, - txDefaults?: Partial, - logDecodeDependencies?: { [contractName: string]: ContractAbi }, - ) { - super( - 'EthBalanceChecker', - EthBalanceCheckerContract.ABI(), - address, - supportedProvider, - txDefaults, - logDecodeDependencies, - ); + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + super('EthBalanceChecker', EthBalanceCheckerContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts index 873bde5b79..460a0c1d6d 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts @@ -1,14 +1,11 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { - BaseContract, +import { BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager, - PromiseWithTransactionHash, -} from '@0x/base-contract'; + SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -86,6 +83,7 @@ export interface ExchangeAssetProxyRegisteredEventArgs extends DecodedLogArgs { assetProxy: string; } + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name @@ -95,7 +93,8 @@ export class ExchangeContract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -105,8 +104,9 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('filled(bytes32)', [index_0]); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('filled(bytes32)', [index_0 + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -115,179 +115,128 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('filled(bytes32)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: string): string { + getABIEncodedTransactionData( + index_0: string, + ): string { assert.isString('index_0', index_0); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('filled(bytes32)', [index_0]); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('filled(bytes32)', [index_0 + ]); return abiEncodedTransactionData; }, }; public batchFillOrders = { async sendTransactionAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmounts: BigNumber[], signatures: string[], - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', - [orders, takerAssetFillAmounts, signatures], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.batchFillOrders.estimateGasAsync.bind(self, orders, takerAssetFillAmounts, signatures), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, + takerAssetFillAmounts, + signatures + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.batchFillOrders.estimateGasAsync.bind( + self, + orders, + takerAssetFillAmounts, + signatures + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmounts: BigNumber[], signatures: string[], txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.batchFillOrders.sendTransactionAsync( - orders, - takerAssetFillAmounts, - signatures, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const txHashPromise = self.batchFillOrders.sendTransactionAsync(orders, + takerAssetFillAmounts, + signatures + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmounts: BigNumber[], signatures: string[], txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', - [orders, takerAssetFillAmounts, signatures], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, + takerAssetFillAmounts, + signatures + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmounts: BigNumber[], signatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }> { + ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + > { assert.isArray('orders', orders); assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); assert.isArray('signatures', signatures); @@ -299,11 +248,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', - [orders, takerAssetFillAmounts, signatures], - ); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, + takerAssetFillAmounts, + signatures + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -312,51 +261,30 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', - ); + const abiEncoder = self._lookupAbiEncoder('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - ): string { + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + takerAssetFillAmounts: BigNumber[], + signatures: string[], + ): string { assert.isArray('orders', orders); assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', - [orders, takerAssetFillAmounts, signatures], - ); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, + takerAssetFillAmounts, + signatures + ]); return abiEncodedTransactionData; }, }; @@ -365,7 +293,8 @@ export class ExchangeContract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -375,8 +304,9 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('cancelled(bytes32)', [index_0]); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('cancelled(bytes32)', [index_0 + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -385,22 +315,24 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('cancelled(bytes32)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: string): string { + getABIEncodedTransactionData( + index_0: string, + ): string { assert.isString('index_0', index_0); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('cancelled(bytes32)', [index_0]); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('cancelled(bytes32)', [index_0 + ]); return abiEncodedTransactionData; }, }; @@ -409,32 +341,36 @@ export class ExchangeContract extends BaseContract { hash: string, signerAddress: string, signature: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('hash', hash); - assert.isString('signerAddress', signerAddress); - assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [ + assert.isString('hash', hash); + assert.isString('signerAddress', signerAddress); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [hash, + signerAddress.toLowerCase(), + signature + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.preSign.estimateGasAsync.bind( + self, hash, signerAddress.toLowerCase(), - signature, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.preSign.estimateGasAsync.bind(self, hash, signerAddress.toLowerCase(), signature), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + signature + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( hash: string, @@ -444,27 +380,25 @@ export class ExchangeContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('hash', hash); - assert.isString('signerAddress', signerAddress); - assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.preSign.sendTransactionAsync( - hash, - signerAddress.toLowerCase(), - signature, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('hash', hash); + assert.isString('signerAddress', signerAddress); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const txHashPromise = self.preSign.sendTransactionAsync(hash, + signerAddress.toLowerCase(), + signature + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( hash: string, @@ -472,29 +406,28 @@ export class ExchangeContract extends BaseContract { signature: string, txData?: Partial | undefined, ): Promise { - assert.isString('hash', hash); - assert.isString('signerAddress', signerAddress); - assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [ - hash, - signerAddress.toLowerCase(), - signature, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('hash', hash); + assert.isString('signerAddress', signerAddress); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [hash, + signerAddress.toLowerCase(), + signature + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( hash: string, @@ -502,7 +435,8 @@ export class ExchangeContract extends BaseContract { signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('hash', hash); assert.isString('signerAddress', signerAddress); assert.isString('signature', signature); @@ -514,12 +448,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [ - hash, - signerAddress.toLowerCase(), - signature, - ]); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [hash, + signerAddress.toLowerCase(), + signature + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -528,248 +461,147 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('preSign(bytes32,address,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(hash: string, signerAddress: string, signature: string): string { + getABIEncodedTransactionData( + hash: string, + signerAddress: string, + signature: string, + ): string { assert.isString('hash', hash); assert.isString('signerAddress', signerAddress); assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [ - hash, - signerAddress.toLowerCase(), - signature, - ]); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [hash, + signerAddress.toLowerCase(), + signature + ]); return abiEncodedTransactionData; }, }; public matchOrders = { async sendTransactionAsync( - leftOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - rightOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, leftSignature: string, rightSignature: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('leftSignature', leftSignature); - assert.isString('rightSignature', rightSignature); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', - [leftOrder, rightOrder, leftSignature, rightSignature], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.matchOrders.estimateGasAsync.bind(self, leftOrder, rightOrder, leftSignature, rightSignature), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + + + assert.isString('leftSignature', leftSignature); + assert.isString('rightSignature', rightSignature); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [leftOrder, + rightOrder, + leftSignature, + rightSignature + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.matchOrders.estimateGasAsync.bind( + self, + leftOrder, + rightOrder, + leftSignature, + rightSignature + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - leftOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - rightOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, leftSignature: string, rightSignature: string, txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('leftSignature', leftSignature); - assert.isString('rightSignature', rightSignature); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.matchOrders.sendTransactionAsync( - leftOrder, - rightOrder, - leftSignature, - rightSignature, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + + + assert.isString('leftSignature', leftSignature); + assert.isString('rightSignature', rightSignature); + const self = this as any as ExchangeContract; + const txHashPromise = self.matchOrders.sendTransactionAsync(leftOrder, + rightOrder, + leftSignature, + rightSignature + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - leftOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - rightOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, leftSignature: string, rightSignature: string, txData?: Partial | undefined, ): Promise { - assert.isString('leftSignature', leftSignature); - assert.isString('rightSignature', rightSignature); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', - [leftOrder, rightOrder, leftSignature, rightSignature], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + + + assert.isString('leftSignature', leftSignature); + assert.isString('rightSignature', rightSignature); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [leftOrder, + rightOrder, + leftSignature, + rightSignature + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - leftOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - rightOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, leftSignature: string, rightSignature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{ - left: { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }; - right: { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }; - leftMakerAssetSpreadAmount: BigNumber; - }> { + ): Promise<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber} + > { + + assert.isString('leftSignature', leftSignature); assert.isString('rightSignature', rightSignature); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -780,11 +612,12 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', - [leftOrder, rightOrder, leftSignature, rightSignature], - ); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [leftOrder, + rightOrder, + leftSignature, + rightSignature + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -793,227 +626,138 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(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)', - ); + const abiEncoder = self._lookupAbiEncoder('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ - left: { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }; - right: { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }; - leftMakerAssetSpreadAmount: BigNumber; - }>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber} + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - leftOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - rightOrder: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - leftSignature: string, - rightSignature: string, - ): string { + leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + leftSignature: string, + rightSignature: string, + ): string { + + assert.isString('leftSignature', leftSignature); assert.isString('rightSignature', rightSignature); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', - [leftOrder, rightOrder, leftSignature, rightSignature], - ); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [leftOrder, + rightOrder, + leftSignature, + rightSignature + ]); return abiEncodedTransactionData; }, }; public fillOrderNoThrow = { async sendTransactionAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, takerAssetFillAmount: BigNumber, signature: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', - [order, takerAssetFillAmount, signature], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.fillOrderNoThrow.estimateGasAsync.bind(self, order, takerAssetFillAmount, signature), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, + takerAssetFillAmount, + signature + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.fillOrderNoThrow.estimateGasAsync.bind( + self, + order, + takerAssetFillAmount, + signature + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, takerAssetFillAmount: BigNumber, signature: string, txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.fillOrderNoThrow.sendTransactionAsync( - order, - takerAssetFillAmount, - signature, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const txHashPromise = self.fillOrderNoThrow.sendTransactionAsync(order, + takerAssetFillAmount, + signature + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, takerAssetFillAmount: BigNumber, signature: string, txData?: Partial | undefined, ): Promise { - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', - [order, takerAssetFillAmount, signature], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, + takerAssetFillAmount, + signature + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, takerAssetFillAmount: BigNumber, signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }> { + ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + > { + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -1024,11 +768,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', - [order, takerAssetFillAmount, signature], - ); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, + takerAssetFillAmount, + signature + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1037,55 +781,40 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', - ); + const abiEncoder = self._lookupAbiEncoder('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - takerAssetFillAmount: BigNumber, - signature: string, - ): string { + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + takerAssetFillAmount: BigNumber, + signature: string, + ): string { + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', - [order, takerAssetFillAmount, signature], - ); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, + takerAssetFillAmount, + signature + ]); return abiEncodedTransactionData; }, }; public assetProxies = { - async callAsync(index_0: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + index_0: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1095,8 +824,9 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0]); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0 + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1105,155 +835,106 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('assetProxies(bytes4)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: string): string { + getABIEncodedTransactionData( + index_0: string, + ): string { assert.isString('index_0', index_0); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0]); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0 + ]); return abiEncodedTransactionData; }, }; public batchCancelOrders = { async sendTransactionAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, - txData?: Partial | undefined, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', - [orders], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.batchCancelOrders.estimateGasAsync.bind(self, orders), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - awaitTransactionSuccessAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + assert.isArray('orders', orders); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.batchCancelOrders.estimateGasAsync.bind( + self, + orders + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + awaitTransactionSuccessAsync( + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.batchCancelOrders.sendTransactionAsync(orders, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + const self = this as any as ExchangeContract; + const txHashPromise = self.batchCancelOrders.sendTransactionAsync(orders + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', - [orders], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isArray('orders', orders); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1263,11 +944,9 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', - [orders], - ); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1276,199 +955,128 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', - ); + const abiEncoder = self._lookupAbiEncoder('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, - ): string { + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + ): string { assert.isArray('orders', orders); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', - [orders], - ); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders + ]); return abiEncodedTransactionData; }, }; public batchFillOrKillOrders = { async sendTransactionAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmounts: BigNumber[], signatures: string[], - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', - [orders, takerAssetFillAmounts, signatures], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.batchFillOrKillOrders.estimateGasAsync.bind(self, orders, takerAssetFillAmounts, signatures), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, + takerAssetFillAmounts, + signatures + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.batchFillOrKillOrders.estimateGasAsync.bind( + self, + orders, + takerAssetFillAmounts, + signatures + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmounts: BigNumber[], signatures: string[], txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.batchFillOrKillOrders.sendTransactionAsync( - orders, - takerAssetFillAmounts, - signatures, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const txHashPromise = self.batchFillOrKillOrders.sendTransactionAsync(orders, + takerAssetFillAmounts, + signatures + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmounts: BigNumber[], signatures: string[], txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', - [orders, takerAssetFillAmounts, signatures], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, + takerAssetFillAmounts, + signatures + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmounts: BigNumber[], signatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }> { + ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + > { assert.isArray('orders', orders); assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); assert.isArray('signatures', signatures); @@ -1480,11 +1088,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', - [orders, takerAssetFillAmounts, signatures], - ); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, + takerAssetFillAmounts, + signatures + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1493,74 +1101,60 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', - ); + const abiEncoder = self._lookupAbiEncoder('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - ): string { + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + takerAssetFillAmounts: BigNumber[], + signatures: string[], + ): string { assert.isArray('orders', orders); assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', - [orders, takerAssetFillAmounts, signatures], - ); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, + takerAssetFillAmounts, + signatures + ]); return abiEncodedTransactionData; }, }; public cancelOrdersUpTo = { - async sendTransactionAsync(targetOrderEpoch: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.cancelOrdersUpTo.estimateGasAsync.bind(self, targetOrderEpoch), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + targetOrderEpoch: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.cancelOrdersUpTo.estimateGasAsync.bind( + self, + targetOrderEpoch + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( targetOrderEpoch: BigNumber, @@ -1568,45 +1162,51 @@ export class ExchangeContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.cancelOrdersUpTo.sendTransactionAsync(targetOrderEpoch, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); + const self = this as any as ExchangeContract; + const txHashPromise = self.cancelOrdersUpTo.sendTransactionAsync(targetOrderEpoch + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(targetOrderEpoch: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + targetOrderEpoch: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( targetOrderEpoch: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1616,8 +1216,9 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch]); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1626,181 +1227,128 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('cancelOrdersUpTo(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(targetOrderEpoch: BigNumber): string { + getABIEncodedTransactionData( + targetOrderEpoch: BigNumber, + ): string { assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [ - targetOrderEpoch, - ]); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch + ]); return abiEncodedTransactionData; }, }; public batchFillOrdersNoThrow = { async sendTransactionAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmounts: BigNumber[], signatures: string[], - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', - [orders, takerAssetFillAmounts, signatures], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.batchFillOrdersNoThrow.estimateGasAsync.bind(self, orders, takerAssetFillAmounts, signatures), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, + takerAssetFillAmounts, + signatures + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.batchFillOrdersNoThrow.estimateGasAsync.bind( + self, + orders, + takerAssetFillAmounts, + signatures + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmounts: BigNumber[], signatures: string[], txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.batchFillOrdersNoThrow.sendTransactionAsync( - orders, - takerAssetFillAmounts, - signatures, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const txHashPromise = self.batchFillOrdersNoThrow.sendTransactionAsync(orders, + takerAssetFillAmounts, + signatures + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmounts: BigNumber[], signatures: string[], txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', - [orders, takerAssetFillAmounts, signatures], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, + takerAssetFillAmounts, + signatures + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmounts: BigNumber[], signatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }> { + ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + > { assert.isArray('orders', orders); assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); assert.isArray('signatures', signatures); @@ -1812,11 +1360,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', - [orders, takerAssetFillAmounts, signatures], - ); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, + takerAssetFillAmounts, + signatures + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1825,51 +1373,30 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', - ); + const abiEncoder = self._lookupAbiEncoder('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - ): string { + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + takerAssetFillAmounts: BigNumber[], + signatures: string[], + ): string { assert.isArray('orders', orders); assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', - [orders, takerAssetFillAmounts, signatures], - ); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, + takerAssetFillAmounts, + signatures + ]); return abiEncodedTransactionData; }, }; @@ -1878,7 +1405,8 @@ export class ExchangeContract extends BaseContract { assetProxyId: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('assetProxyId', assetProxyId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1888,8 +1416,9 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId]); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1898,22 +1427,24 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAssetProxy(bytes4)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(assetProxyId: string): string { + getABIEncodedTransactionData( + assetProxyId: string, + ): string { assert.isString('assetProxyId', assetProxyId); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId]); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId + ]); return abiEncodedTransactionData; }, }; @@ -1922,7 +1453,8 @@ export class ExchangeContract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1932,8 +1464,9 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('transactions(bytes32)', [index_0]); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('transactions(bytes32)', [index_0 + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1942,176 +1475,129 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transactions(bytes32)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: string): string { + getABIEncodedTransactionData( + index_0: string, + ): string { assert.isString('index_0', index_0); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transactions(bytes32)', [index_0]); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transactions(bytes32)', [index_0 + ]); return abiEncodedTransactionData; }, }; public fillOrKillOrder = { async sendTransactionAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, takerAssetFillAmount: BigNumber, signature: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', - [order, takerAssetFillAmount, signature], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.fillOrKillOrder.estimateGasAsync.bind(self, order, takerAssetFillAmount, signature), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, + takerAssetFillAmount, + signature + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.fillOrKillOrder.estimateGasAsync.bind( + self, + order, + takerAssetFillAmount, + signature + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, takerAssetFillAmount: BigNumber, signature: string, txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.fillOrKillOrder.sendTransactionAsync( - order, - takerAssetFillAmount, - signature, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const txHashPromise = self.fillOrKillOrder.sendTransactionAsync(order, + takerAssetFillAmount, + signature + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, takerAssetFillAmount: BigNumber, signature: string, txData?: Partial | undefined, ): Promise { - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', - [order, takerAssetFillAmount, signature], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, + takerAssetFillAmount, + signature + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, takerAssetFillAmount: BigNumber, signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }> { + ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + > { + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -2122,11 +1608,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', - [order, takerAssetFillAmount, signature], - ); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, + takerAssetFillAmount, + signature + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2135,50 +1621,30 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', - ); + const abiEncoder = self._lookupAbiEncoder('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - takerAssetFillAmount: BigNumber, - signature: string, - ): string { + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + takerAssetFillAmount: BigNumber, + signature: string, + ): string { + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', - [order, takerAssetFillAmount, signature], - ); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, + takerAssetFillAmount, + signature + ]); return abiEncodedTransactionData; }, }; @@ -2186,34 +1652,33 @@ export class ExchangeContract extends BaseContract { async sendTransactionAsync( validatorAddress: string, approval: boolean, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('validatorAddress', validatorAddress); - assert.isBoolean('approval', approval); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [ + assert.isString('validatorAddress', validatorAddress); + assert.isBoolean('approval', approval); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [validatorAddress.toLowerCase(), + approval + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.setSignatureValidatorApproval.estimateGasAsync.bind( + self, validatorAddress.toLowerCase(), - approval, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.setSignatureValidatorApproval.estimateGasAsync.bind( - self, - validatorAddress.toLowerCase(), - approval, - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + approval + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( validatorAddress: string, @@ -2222,59 +1687,57 @@ export class ExchangeContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('validatorAddress', validatorAddress); - assert.isBoolean('approval', approval); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.setSignatureValidatorApproval.sendTransactionAsync( - validatorAddress.toLowerCase(), - approval, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('validatorAddress', validatorAddress); + assert.isBoolean('approval', approval); + const self = this as any as ExchangeContract; + const txHashPromise = self.setSignatureValidatorApproval.sendTransactionAsync(validatorAddress.toLowerCase(), + approval + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( validatorAddress: string, approval: boolean, txData?: Partial | undefined, ): Promise { - assert.isString('validatorAddress', validatorAddress); - assert.isBoolean('approval', approval); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [ - validatorAddress.toLowerCase(), - approval, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('validatorAddress', validatorAddress); + assert.isBoolean('approval', approval); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [validatorAddress.toLowerCase(), + approval + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( validatorAddress: string, approval: boolean, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('validatorAddress', validatorAddress); assert.isBoolean('approval', approval); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -2285,11 +1748,10 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [ - validatorAddress.toLowerCase(), - approval, - ]); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [validatorAddress.toLowerCase(), + approval + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2298,26 +1760,27 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('setSignatureValidatorApproval(address,bool)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(validatorAddress: string, approval: boolean): string { + getABIEncodedTransactionData( + validatorAddress: string, + approval: boolean, + ): string { assert.isString('validatorAddress', validatorAddress); assert.isBoolean('approval', approval); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'setSignatureValidatorApproval(address,bool)', - [validatorAddress.toLowerCase(), approval], - ); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [validatorAddress.toLowerCase(), + approval + ]); return abiEncodedTransactionData; }, }; @@ -2327,7 +1790,8 @@ export class ExchangeContract extends BaseContract { index_1: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.isString('index_1', index_1); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -2338,11 +1802,10 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('allowedValidators(address,address)', [ - index_0.toLowerCase(), - index_1.toLowerCase(), - ]); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('allowedValidators(address,address)', [index_0.toLowerCase(), + index_1.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2351,183 +1814,131 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('allowedValidators(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: string, index_1: string): string { + getABIEncodedTransactionData( + index_0: string, + index_1: string, + ): string { assert.isString('index_0', index_0); assert.isString('index_1', index_1); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('allowedValidators(address,address)', [ - index_0.toLowerCase(), - index_1.toLowerCase(), - ]); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('allowedValidators(address,address)', [index_0.toLowerCase(), + index_1.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public marketSellOrders = { async sendTransactionAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmount: BigNumber, signatures: string[], - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - [orders, takerAssetFillAmount, signatures], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.marketSellOrders.estimateGasAsync.bind(self, orders, takerAssetFillAmount, signatures), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isArray('orders', orders); + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + takerAssetFillAmount, + signatures + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.marketSellOrders.estimateGasAsync.bind( + self, + orders, + takerAssetFillAmount, + signatures + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.marketSellOrders.sendTransactionAsync( - orders, - takerAssetFillAmount, - signatures, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const txHashPromise = self.marketSellOrders.sendTransactionAsync(orders, + takerAssetFillAmount, + signatures + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - [orders, takerAssetFillAmount, signatures], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + takerAssetFillAmount, + signatures + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmount: BigNumber, signatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }> { + ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + > { assert.isArray('orders', orders); assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isArray('signatures', signatures); @@ -2539,11 +1950,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - [orders, takerAssetFillAmount, signatures], - ); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + takerAssetFillAmount, + signatures + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2552,73 +1963,40 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - ); + const abiEncoder = self._lookupAbiEncoder('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, - takerAssetFillAmount: BigNumber, - signatures: string[], - ): string { + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + takerAssetFillAmount: BigNumber, + signatures: string[], + ): string { assert.isArray('orders', orders); assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - [orders, takerAssetFillAmount, signatures], - ); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + takerAssetFillAmount, + signatures + ]); return abiEncodedTransactionData; }, }; public getOrdersInfo = { async callAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise> { + ): Promise + > { assert.isArray('orders', orders); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -2628,11 +2006,9 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', - [orders], - ); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2641,44 +2017,24 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', - ); + const abiEncoder = self._lookupAbiEncoder('getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue< - Array<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }> - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, - ): string { + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + ): string { assert.isArray('orders', orders); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', - [orders], - ); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders + ]); return abiEncodedTransactionData; }, }; @@ -2688,7 +2044,8 @@ export class ExchangeContract extends BaseContract { index_1: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.isString('index_1', index_1); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -2699,11 +2056,10 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('preSigned(bytes32,address)', [ - index_0, - index_1.toLowerCase(), - ]); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('preSigned(bytes32,address)', [index_0, + index_1.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2712,31 +2068,36 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('preSigned(bytes32,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: string, index_1: string): string { + getABIEncodedTransactionData( + index_0: string, + index_1: string, + ): string { assert.isString('index_0', index_0); assert.isString('index_1', index_1); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('preSigned(bytes32,address)', [ - index_0, - index_1.toLowerCase(), - ]); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('preSigned(bytes32,address)', [index_0, + index_1.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public owner = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -2745,7 +2106,7 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; + const self = this as any as ExchangeContract; const encodedData = self._strictEncodeArguments('owner()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -2755,20 +2116,20 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as ExchangeContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as ExchangeContract; const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); return abiEncodedTransactionData; }, @@ -2780,7 +2141,8 @@ export class ExchangeContract extends BaseContract { signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('hash', hash); assert.isString('signerAddress', signerAddress); assert.isString('signature', signature); @@ -2792,12 +2154,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [ - hash, - signerAddress.toLowerCase(), - signature, - ]); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [hash, + signerAddress.toLowerCase(), + signature + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2806,185 +2167,134 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isValidSignature(bytes32,address,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(hash: string, signerAddress: string, signature: string): string { + getABIEncodedTransactionData( + hash: string, + signerAddress: string, + signature: string, + ): string { assert.isString('hash', hash); assert.isString('signerAddress', signerAddress); assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [ - hash, - signerAddress.toLowerCase(), - signature, - ]); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [hash, + signerAddress.toLowerCase(), + signature + ]); return abiEncodedTransactionData; }, }; public marketBuyOrdersNoThrow = { async sendTransactionAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, makerAssetFillAmount: BigNumber, - signatures: string[], - txData?: Partial | undefined, - ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - [orders, makerAssetFillAmount, signatures], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.marketBuyOrdersNoThrow.estimateGasAsync.bind(self, orders, makerAssetFillAmount, signatures), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + signatures: string[], + txData?: Partial | undefined, + ): Promise { + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + makerAssetFillAmount, + signatures + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.marketBuyOrdersNoThrow.estimateGasAsync.bind( + self, + orders, + makerAssetFillAmount, + signatures + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, makerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.marketBuyOrdersNoThrow.sendTransactionAsync( - orders, - makerAssetFillAmount, - signatures, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const txHashPromise = self.marketBuyOrdersNoThrow.sendTransactionAsync(orders, + makerAssetFillAmount, + signatures + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, makerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - [orders, makerAssetFillAmount, signatures], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + makerAssetFillAmount, + signatures + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, makerAssetFillAmount: BigNumber, signatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }> { + ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + > { assert.isArray('orders', orders); assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); assert.isArray('signatures', signatures); @@ -2996,11 +2306,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - [orders, makerAssetFillAmount, signatures], - ); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + makerAssetFillAmount, + signatures + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -3009,200 +2319,135 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - ); + const abiEncoder = self._lookupAbiEncoder('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, - makerAssetFillAmount: BigNumber, - signatures: string[], - ): string { + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + makerAssetFillAmount: BigNumber, + signatures: string[], + ): string { assert.isArray('orders', orders); assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - [orders, makerAssetFillAmount, signatures], - ); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + makerAssetFillAmount, + signatures + ]); return abiEncodedTransactionData; }, }; public fillOrder = { async sendTransactionAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, takerAssetFillAmount: BigNumber, signature: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', - [order, takerAssetFillAmount, signature], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.fillOrder.estimateGasAsync.bind(self, order, takerAssetFillAmount, signature), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, + takerAssetFillAmount, + signature + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.fillOrder.estimateGasAsync.bind( + self, + order, + takerAssetFillAmount, + signature + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, takerAssetFillAmount: BigNumber, signature: string, txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.fillOrder.sendTransactionAsync(order, takerAssetFillAmount, signature, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const txHashPromise = self.fillOrder.sendTransactionAsync(order, + takerAssetFillAmount, + signature + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, takerAssetFillAmount: BigNumber, signature: string, txData?: Partial | undefined, ): Promise { - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', - [order, takerAssetFillAmount, signature], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, + takerAssetFillAmount, + signature + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, takerAssetFillAmount: BigNumber, signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }> { + ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + > { + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -3213,11 +2458,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', - [order, takerAssetFillAmount, signature], - ); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, + takerAssetFillAmount, + signature + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -3226,50 +2471,30 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', - ); + const abiEncoder = self._lookupAbiEncoder('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - takerAssetFillAmount: BigNumber, - signature: string, - ): string { + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + takerAssetFillAmount: BigNumber, + signature: string, + ): string { + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', - [order, takerAssetFillAmount, signature], - ); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, + takerAssetFillAmount, + signature + ]); return abiEncodedTransactionData; }, }; @@ -3279,34 +2504,39 @@ export class ExchangeContract extends BaseContract { signerAddress: string, data: string, signature: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isBigNumber('salt', salt); - assert.isString('signerAddress', signerAddress); - assert.isString('data', data); - assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [ + assert.isBigNumber('salt', salt); + assert.isString('signerAddress', signerAddress); + assert.isString('data', data); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [salt, + signerAddress.toLowerCase(), + data, + signature + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.executeTransaction.estimateGasAsync.bind( + self, salt, signerAddress.toLowerCase(), data, - signature, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.executeTransaction.estimateGasAsync.bind(self, salt, signerAddress.toLowerCase(), data, signature), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + signature + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( salt: BigNumber, @@ -3317,29 +2547,27 @@ export class ExchangeContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('salt', salt); - assert.isString('signerAddress', signerAddress); - assert.isString('data', data); - assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.executeTransaction.sendTransactionAsync( - salt, - signerAddress.toLowerCase(), - data, - signature, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('salt', salt); + assert.isString('signerAddress', signerAddress); + assert.isString('data', data); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const txHashPromise = self.executeTransaction.sendTransactionAsync(salt, + signerAddress.toLowerCase(), + data, + signature + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( salt: BigNumber, @@ -3348,31 +2576,30 @@ export class ExchangeContract extends BaseContract { signature: string, txData?: Partial | undefined, ): Promise { - assert.isBigNumber('salt', salt); - assert.isString('signerAddress', signerAddress); - assert.isString('data', data); - assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [ - salt, - signerAddress.toLowerCase(), - data, - signature, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isBigNumber('salt', salt); + assert.isString('signerAddress', signerAddress); + assert.isString('data', data); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [salt, + signerAddress.toLowerCase(), + data, + signature + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( salt: BigNumber, @@ -3381,7 +2608,8 @@ export class ExchangeContract extends BaseContract { signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('salt', salt); assert.isString('signerAddress', signerAddress); assert.isString('data', data); @@ -3394,13 +2622,12 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [ - salt, - signerAddress.toLowerCase(), - data, - signature, - ]); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [salt, + signerAddress.toLowerCase(), + data, + signature + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -3409,51 +2636,63 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('executeTransaction(uint256,address,bytes,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(salt: BigNumber, signerAddress: string, data: string, signature: string): string { + getABIEncodedTransactionData( + salt: BigNumber, + signerAddress: string, + data: string, + signature: string, + ): string { assert.isBigNumber('salt', salt); assert.isString('signerAddress', signerAddress); assert.isString('data', data); assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'executeTransaction(uint256,address,bytes,bytes)', - [salt, signerAddress.toLowerCase(), data, signature], - ); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [salt, + signerAddress.toLowerCase(), + data, + signature + ]); return abiEncodedTransactionData; }, }; public registerAssetProxy = { - async sendTransactionAsync(assetProxy: string, txData?: Partial | undefined): Promise { - assert.isString('assetProxy', assetProxy); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.registerAssetProxy.estimateGasAsync.bind(self, assetProxy.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + assetProxy: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('assetProxy', assetProxy); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.registerAssetProxy.estimateGasAsync.bind( + self, + assetProxy.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( assetProxy: string, @@ -3461,45 +2700,51 @@ export class ExchangeContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('assetProxy', assetProxy); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.registerAssetProxy.sendTransactionAsync(assetProxy.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('assetProxy', assetProxy); + const self = this as any as ExchangeContract; + const txHashPromise = self.registerAssetProxy.sendTransactionAsync(assetProxy.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(assetProxy: string, txData?: Partial | undefined): Promise { - assert.isString('assetProxy', assetProxy); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + assetProxy: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('assetProxy', assetProxy); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( assetProxy: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('assetProxy', assetProxy); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -3509,8 +2754,9 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase()]); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -3519,46 +2765,35 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(assetProxy: string): string { + getABIEncodedTransactionData( + assetProxy: string, + ): string { assert.isString('assetProxy', assetProxy); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address)', [ - assetProxy.toLowerCase(), - ]); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public getOrderInfo = { async callAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }> { + ): Promise<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber} + > { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -3567,11 +2802,9 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', - [order], - ); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -3580,173 +2813,107 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', - ); + const abiEncoder = self._lookupAbiEncoder('getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ - orderStatus: number; - orderHash: string; - orderTakerAssetFilledAmount: BigNumber; - }>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber} + >(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }): string { - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', - [order], - ); + getABIEncodedTransactionData( + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + ): string { + + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order + ]); return abiEncodedTransactionData; }, }; public cancelOrder = { async sendTransactionAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - txData?: Partial | undefined, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + txData?: Partial | undefined, ): Promise { - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', - [order], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.cancelOrder.estimateGasAsync.bind(self, order), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.cancelOrder.estimateGasAsync.bind( + self, + order + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - const self = (this as any) as ExchangeContract; - const txHashPromise = self.cancelOrder.sendTransactionAsync(order, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + + const self = this as any as ExchangeContract; + const txHashPromise = self.cancelOrder.sendTransactionAsync(order + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, txData?: Partial | undefined, ): Promise { - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', - [order], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -3755,11 +2922,9 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', - [order], - ); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -3768,39 +2933,24 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', - ); + const abiEncoder = self._lookupAbiEncoder('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }): string { - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', - [order], - ); + getABIEncodedTransactionData( + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + ): string { + + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order + ]); return abiEncodedTransactionData; }, }; @@ -3810,7 +2960,8 @@ export class ExchangeContract extends BaseContract { index_1: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.isString('index_1', index_1); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -3821,11 +2972,10 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('orderEpoch(address,address)', [ - index_0.toLowerCase(), - index_1.toLowerCase(), - ]); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('orderEpoch(address,address)', [index_0.toLowerCase(), + index_1.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -3834,31 +2984,36 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('orderEpoch(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: string, index_1: string): string { + getABIEncodedTransactionData( + index_0: string, + index_1: string, + ): string { assert.isString('index_0', index_0); assert.isString('index_1', index_1); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('orderEpoch(address,address)', [ - index_0.toLowerCase(), - index_1.toLowerCase(), - ]); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('orderEpoch(address,address)', [index_0.toLowerCase(), + index_1.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public ZRX_ASSET_DATA = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -3867,7 +3022,7 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; + const self = this as any as ExchangeContract; const encodedData = self._strictEncodeArguments('ZRX_ASSET_DATA()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -3877,178 +3032,125 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('ZRX_ASSET_DATA()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as ExchangeContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as ExchangeContract; const abiEncodedTransactionData = self._strictEncodeArguments('ZRX_ASSET_DATA()', []); return abiEncodedTransactionData; }, }; public marketSellOrdersNoThrow = { async sendTransactionAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmount: BigNumber, signatures: string[], - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - [orders, takerAssetFillAmount, signatures], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.marketSellOrdersNoThrow.estimateGasAsync.bind(self, orders, takerAssetFillAmount, signatures), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isArray('orders', orders); + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + takerAssetFillAmount, + signatures + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.marketSellOrdersNoThrow.estimateGasAsync.bind( + self, + orders, + takerAssetFillAmount, + signatures + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.marketSellOrdersNoThrow.sendTransactionAsync( - orders, - takerAssetFillAmount, - signatures, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const txHashPromise = self.marketSellOrdersNoThrow.sendTransactionAsync(orders, + takerAssetFillAmount, + signatures + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - [orders, takerAssetFillAmount, signatures], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + takerAssetFillAmount, + signatures + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmount: BigNumber, signatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }> { + ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + > { assert.isArray('orders', orders); assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isArray('signatures', signatures); @@ -4060,11 +3162,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - [orders, takerAssetFillAmount, signatures], - ); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + takerAssetFillAmount, + signatures + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -4073,56 +3175,39 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - ); + const abiEncoder = self._lookupAbiEncoder('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, - takerAssetFillAmount: BigNumber, - signatures: string[], - ): string { + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + takerAssetFillAmount: BigNumber, + signatures: string[], + ): string { assert.isArray('orders', orders); assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - [orders, takerAssetFillAmount, signatures], - ); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + takerAssetFillAmount, + signatures + ]); return abiEncodedTransactionData; }, }; public EIP712_DOMAIN_HASH = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -4131,7 +3216,7 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; + const self = this as any as ExchangeContract; const encodedData = self._strictEncodeArguments('EIP712_DOMAIN_HASH()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -4141,178 +3226,125 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('EIP712_DOMAIN_HASH()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as ExchangeContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as ExchangeContract; const abiEncodedTransactionData = self._strictEncodeArguments('EIP712_DOMAIN_HASH()', []); return abiEncodedTransactionData; }, }; public marketBuyOrders = { async sendTransactionAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, makerAssetFillAmount: BigNumber, signatures: string[], - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - [orders, makerAssetFillAmount, signatures], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.marketBuyOrders.estimateGasAsync.bind(self, orders, makerAssetFillAmount, signatures), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + makerAssetFillAmount, + signatures + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.marketBuyOrders.estimateGasAsync.bind( + self, + orders, + makerAssetFillAmount, + signatures + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, makerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.marketBuyOrders.sendTransactionAsync( - orders, - makerAssetFillAmount, - signatures, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const txHashPromise = self.marketBuyOrders.sendTransactionAsync(orders, + makerAssetFillAmount, + signatures + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, makerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - [orders, makerAssetFillAmount, signatures], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + makerAssetFillAmount, + signatures + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, makerAssetFillAmount: BigNumber, signatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }> { + ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + > { assert.isArray('orders', orders); assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); assert.isArray('signatures', signatures); @@ -4324,11 +3356,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments( - 'marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - [orders, makerAssetFillAmount, signatures], - ); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + makerAssetFillAmount, + signatures + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -4337,56 +3369,39 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - ); + const abiEncoder = self._lookupAbiEncoder('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, - makerAssetFillAmount: BigNumber, - signatures: string[], - ): string { + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + makerAssetFillAmount: BigNumber, + signatures: string[], + ): string { assert.isArray('orders', orders); assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); assert.isArray('signatures', signatures); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', - [orders, makerAssetFillAmount, signatures], - ); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + makerAssetFillAmount, + signatures + ]); return abiEncodedTransactionData; }, }; public currentContextAddress = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -4395,7 +3410,7 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; + const self = this as any as ExchangeContract; const encodedData = self._strictEncodeArguments('currentContextAddress()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -4405,44 +3420,51 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('currentContextAddress()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as ExchangeContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as ExchangeContract; const abiEncodedTransactionData = self._strictEncodeArguments('currentContextAddress()', []); return abiEncodedTransactionData; }, }; public transferOwnership = { - async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + newOwner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('newOwner', newOwner); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferOwnership.estimateGasAsync.bind( + self, + newOwner.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( newOwner: string, @@ -4450,41 +3472,51 @@ export class ExchangeContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('newOwner', newOwner); - const self = (this as any) as ExchangeContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('newOwner', newOwner); + const self = this as any as ExchangeContract; + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + newOwner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('newOwner', newOwner); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + newOwner: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -4494,8 +3526,9 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const self = this as any as ExchangeContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -4504,29 +3537,33 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(newOwner: string): string { + getABIEncodedTransactionData( + newOwner: string, + ): string { assert.isString('newOwner', newOwner); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ - newOwner.toLowerCase(), - ]); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public VERSION = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -4535,7 +3572,7 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ExchangeContract; + const self = this as any as ExchangeContract; const encodedData = self._strictEncodeArguments('VERSION()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -4545,31 +3582,31 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('VERSION()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as ExchangeContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as ExchangeContract; const abiEncodedTransactionData = self._strictEncodeArguments('VERSION()', []); return abiEncodedTransactionData; }, }; - private readonly _subscriptionManager: SubscriptionManager; - public static async deployFrom0xArtifactAsync( +private readonly _subscriptionManager: SubscriptionManager; +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, - _zrxAssetData: string, + logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + _zrxAssetData: string, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -4582,18 +3619,9 @@ export class ExchangeContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); - return ExchangeContract.deployAsync( - bytecode, - abi, - provider, - txDefaults, - logDecodeDependenciesAbiOnly, - _zrxAssetData, - ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); + return ExchangeContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, _zrxAssetData +); } public static async deployAsync( bytecode: string, @@ -4601,7 +3629,7 @@ export class ExchangeContract extends BaseContract { supportedProvider: SupportedProvider, txDefaults: Partial, logDecodeDependencies: { [contractName: string]: ContractAbi }, - _zrxAssetData: string, + _zrxAssetData: string, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -4611,17 +3639,20 @@ export class ExchangeContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_zrxAssetData] = BaseContract._formatABIDataItemList( + [_zrxAssetData +] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [_zrxAssetData], + [_zrxAssetData +], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_zrxAssetData]); + const txData = deployInfo.encode(bytecode, [_zrxAssetData +]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -4629,22 +3660,19 @@ export class ExchangeContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`Exchange successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ExchangeContract( - txReceipt.contractAddress as string, - provider, - txDefaults, - logDecodeDependencies, - ); - contractInstance.constructorArgs = [_zrxAssetData]; + const contractInstance = new ExchangeContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); + contractInstance.constructorArgs = [_zrxAssetData +]; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -4663,7 +3691,7 @@ export class ExchangeContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -4718,7 +3746,7 @@ export class ExchangeContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'takerAssetFillAmounts', @@ -4751,14 +3779,14 @@ export class ExchangeContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -4777,7 +3805,7 @@ export class ExchangeContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -4794,12 +3822,13 @@ export class ExchangeContract extends BaseContract { }, ], name: 'preSign', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -4854,7 +3883,7 @@ export class ExchangeContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'rightOrder', @@ -4908,7 +3937,7 @@ export class ExchangeContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'leftSignature', @@ -4945,7 +3974,7 @@ export class ExchangeContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, { name: 'right', @@ -4967,20 +3996,20 @@ export class ExchangeContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, { name: 'leftMakerAssetSpreadAmount', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -5035,7 +4064,7 @@ export class ExchangeContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'takerAssetFillAmount', @@ -5068,14 +4097,14 @@ export class ExchangeContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -5094,7 +4123,7 @@ export class ExchangeContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -5149,16 +4178,17 @@ export class ExchangeContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, ], name: 'batchCancelOrders', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -5213,7 +4243,7 @@ export class ExchangeContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'takerAssetFillAmounts', @@ -5246,14 +4276,14 @@ export class ExchangeContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -5262,12 +4292,13 @@ export class ExchangeContract extends BaseContract { }, ], name: 'cancelOrdersUpTo', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -5322,7 +4353,7 @@ export class ExchangeContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'takerAssetFillAmounts', @@ -5355,14 +4386,14 @@ export class ExchangeContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -5381,7 +4412,7 @@ export class ExchangeContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -5400,7 +4431,7 @@ export class ExchangeContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -5455,7 +4486,7 @@ export class ExchangeContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'takerAssetFillAmount', @@ -5488,14 +4519,14 @@ export class ExchangeContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -5508,12 +4539,13 @@ export class ExchangeContract extends BaseContract { }, ], name: 'setSignatureValidatorApproval', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -5536,7 +4568,7 @@ export class ExchangeContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -5591,7 +4623,7 @@ export class ExchangeContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'takerAssetFillAmount', @@ -5624,14 +4656,14 @@ export class ExchangeContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -5686,7 +4718,7 @@ export class ExchangeContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, ], name: 'getOrdersInfo', @@ -5707,14 +4739,14 @@ export class ExchangeContract extends BaseContract { name: 'orderTakerAssetFilledAmount', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -5737,9 +4769,10 @@ export class ExchangeContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'owner', outputs: [ { @@ -5751,7 +4784,7 @@ export class ExchangeContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -5778,7 +4811,7 @@ export class ExchangeContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -5833,7 +4866,7 @@ export class ExchangeContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'makerAssetFillAmount', @@ -5866,14 +4899,14 @@ export class ExchangeContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -5928,7 +4961,7 @@ export class ExchangeContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'takerAssetFillAmount', @@ -5961,14 +4994,14 @@ export class ExchangeContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -5989,12 +5022,13 @@ export class ExchangeContract extends BaseContract { }, ], name: 'executeTransaction', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -6003,12 +5037,13 @@ export class ExchangeContract extends BaseContract { }, ], name: 'registerAssetProxy', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -6063,7 +5098,7 @@ export class ExchangeContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, ], name: 'getOrderInfo', @@ -6084,14 +5119,14 @@ export class ExchangeContract extends BaseContract { name: 'orderTakerAssetFilledAmount', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -6146,16 +5181,17 @@ export class ExchangeContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, ], name: 'cancelOrder', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -6178,9 +5214,10 @@ export class ExchangeContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'ZRX_ASSET_DATA', outputs: [ { @@ -6192,7 +5229,7 @@ export class ExchangeContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -6247,7 +5284,7 @@ export class ExchangeContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'takerAssetFillAmount', @@ -6280,16 +5317,17 @@ export class ExchangeContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'EIP712_DOMAIN_HASH', outputs: [ { @@ -6301,7 +5339,7 @@ export class ExchangeContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -6356,7 +5394,7 @@ export class ExchangeContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'makerAssetFillAmount', @@ -6389,16 +5427,17 @@ export class ExchangeContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'currentContextAddress', outputs: [ { @@ -6410,7 +5449,7 @@ export class ExchangeContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -6419,14 +5458,16 @@ export class ExchangeContract extends BaseContract { }, ], name: 'transferOwnership', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'VERSION', outputs: [ { @@ -6438,19 +5479,20 @@ export class ExchangeContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { inputs: [ { name: '_zrxAssetData', type: 'bytes', }, ], - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'constructor', }, - { + { anonymous: false, inputs: [ { @@ -6470,10 +5512,11 @@ export class ExchangeContract extends BaseContract { }, ], name: 'SignatureValidatorApproval', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -6533,10 +5576,11 @@ export class ExchangeContract extends BaseContract { }, ], name: 'Fill', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -6571,10 +5615,11 @@ export class ExchangeContract extends BaseContract { }, ], name: 'Cancel', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -6594,10 +5639,11 @@ export class ExchangeContract extends BaseContract { }, ], name: 'CancelUpTo', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -6612,7 +5658,8 @@ export class ExchangeContract extends BaseContract { }, ], name: 'AssetProxyRegistered', - outputs: [], + outputs: [ + ], type: 'event', }, ] as ContractAbi; @@ -6686,12 +5733,7 @@ export class ExchangeContract extends BaseContract { ); return logs; } - constructor( - address: string, - supportedProvider: SupportedProvider, - txDefaults?: Partial, - logDecodeDependencies?: { [contractName: string]: ContractAbi }, - ) { + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { super('Exchange', ExchangeContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( @@ -6699,7 +5741,7 @@ export class ExchangeContract extends BaseContract { this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts b/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts index 4a4e7f68ef..efe2ed7409 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts @@ -1,7 +1,7 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract'; +import { BaseContract,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -23,123 +23,68 @@ import { assert } from '@0x/assert'; import * as ethers from 'ethers'; // tslint:enable:no-unused-variable + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class ForwarderContract extends BaseContract { public marketBuyOrdersWithEth = { async sendTransactionAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, makerAssetFillAmount: BigNumber, signatures: string[], - feeOrders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, feeSignatures: string[], feePercentage: BigNumber, feeRecipient: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - assert.isArray('feeOrders', feeOrders); - assert.isArray('feeSignatures', feeSignatures); - assert.isBigNumber('feePercentage', feePercentage); - assert.isString('feeRecipient', feeRecipient); - const self = (this as any) as ForwarderContract; - const encodedData = self._strictEncodeArguments( - 'marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', - [ - orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase(), - ], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.marketBuyOrdersWithEth.estimateGasAsync.bind( - self, - orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase(), - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + assert.isArray('feeOrders', feeOrders); + assert.isArray('feeSignatures', feeSignatures); + assert.isBigNumber('feePercentage', feePercentage); + assert.isString('feeRecipient', feeRecipient); + const self = this as any as ForwarderContract; + const encodedData = self._strictEncodeArguments('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, + makerAssetFillAmount, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.marketBuyOrdersWithEth.estimateGasAsync.bind( + self, + orders, + makerAssetFillAmount, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, makerAssetFillAmount: BigNumber, signatures: string[], - feeOrders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, feeSignatures: string[], feePercentage: BigNumber, feeRecipient: string, @@ -147,158 +92,86 @@ export class ForwarderContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - assert.isArray('feeOrders', feeOrders); - assert.isArray('feeSignatures', feeSignatures); - assert.isBigNumber('feePercentage', feePercentage); - assert.isString('feeRecipient', feeRecipient); - const self = (this as any) as ForwarderContract; - const txHashPromise = self.marketBuyOrdersWithEth.sendTransactionAsync( - orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase(), - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + assert.isArray('feeOrders', feeOrders); + assert.isArray('feeSignatures', feeSignatures); + assert.isBigNumber('feePercentage', feePercentage); + assert.isString('feeRecipient', feeRecipient); + const self = this as any as ForwarderContract; + const txHashPromise = self.marketBuyOrdersWithEth.sendTransactionAsync(orders, + makerAssetFillAmount, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, makerAssetFillAmount: BigNumber, signatures: string[], - feeOrders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, feeSignatures: string[], feePercentage: BigNumber, feeRecipient: string, txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - assert.isArray('feeOrders', feeOrders); - assert.isArray('feeSignatures', feeSignatures); - assert.isBigNumber('feePercentage', feePercentage); - assert.isString('feeRecipient', feeRecipient); - const self = (this as any) as ForwarderContract; - const encodedData = self._strictEncodeArguments( - 'marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', - [ - orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase(), - ], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + assert.isArray('feeOrders', feeOrders); + assert.isArray('feeSignatures', feeSignatures); + assert.isBigNumber('feePercentage', feePercentage); + assert.isString('feeRecipient', feeRecipient); + const self = this as any as ForwarderContract; + const encodedData = self._strictEncodeArguments('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, + makerAssetFillAmount, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, makerAssetFillAmount: BigNumber, signatures: string[], - feeOrders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, feeSignatures: string[], feePercentage: BigNumber, feeRecipient: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise< - [ - { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }, - { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - } - ] + ): Promise<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}] > { assert.isArray('orders', orders); assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); @@ -315,19 +188,15 @@ export class ForwarderContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ForwarderContract; - const encodedData = self._strictEncodeArguments( - 'marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', - [ - orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase(), - ], - ); + const self = this as any as ForwarderContract; + const encodedData = self._strictEncodeArguments('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, + makerAssetFillAmount, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -336,70 +205,26 @@ export class ForwarderContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(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)', - ); + const abiEncoder = self._lookupAbiEncoder('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue< - [ - { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }, - { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - } - ] - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}] + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, - makerAssetFillAmount: BigNumber, - signatures: string[], - feeOrders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, - feeSignatures: string[], - feePercentage: BigNumber, - feeRecipient: string, - ): string { + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + makerAssetFillAmount: BigNumber, + signatures: string[], + feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + feeSignatures: string[], + feePercentage: BigNumber, + feeRecipient: string, + ): string { assert.isArray('orders', orders); assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); assert.isArray('signatures', signatures); @@ -407,19 +232,15 @@ export class ForwarderContract extends BaseContract { assert.isArray('feeSignatures', feeSignatures); assert.isBigNumber('feePercentage', feePercentage); assert.isString('feeRecipient', feeRecipient); - const self = (this as any) as ForwarderContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', - [ - orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase(), - ], - ); + const self = this as any as ForwarderContract; + const abiEncodedTransactionData = self._strictEncodeArguments('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, + makerAssetFillAmount, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase() + ]); return abiEncodedTransactionData; }, }; @@ -427,27 +248,33 @@ export class ForwarderContract extends BaseContract { async sendTransactionAsync( assetData: string, amount: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('assetData', assetData); - assert.isBigNumber('amount', amount); - const self = (this as any) as ForwarderContract; - const encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData, amount]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.withdrawAsset.estimateGasAsync.bind(self, assetData, amount), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isString('assetData', assetData); + assert.isBigNumber('amount', amount); + const self = this as any as ForwarderContract; + const encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData, + amount + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.withdrawAsset.estimateGasAsync.bind( + self, + assetData, + amount + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( assetData: string, @@ -456,52 +283,57 @@ export class ForwarderContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('assetData', assetData); - assert.isBigNumber('amount', amount); - const self = (this as any) as ForwarderContract; - const txHashPromise = self.withdrawAsset.sendTransactionAsync(assetData, amount, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('assetData', assetData); + assert.isBigNumber('amount', amount); + const self = this as any as ForwarderContract; + const txHashPromise = self.withdrawAsset.sendTransactionAsync(assetData, + amount + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( assetData: string, amount: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('assetData', assetData); - assert.isBigNumber('amount', amount); - const self = (this as any) as ForwarderContract; - const encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData, amount]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('assetData', assetData); + assert.isBigNumber('amount', amount); + const self = this as any as ForwarderContract; + const encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData, + amount + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( assetData: string, amount: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('assetData', assetData); assert.isBigNumber('amount', amount); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -512,8 +344,10 @@ export class ForwarderContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ForwarderContract; - const encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData, amount]); + const self = this as any as ForwarderContract; + const encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData, + amount + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -522,31 +356,36 @@ export class ForwarderContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('withdrawAsset(bytes,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(assetData: string, amount: BigNumber): string { + getABIEncodedTransactionData( + assetData: string, + amount: BigNumber, + ): string { assert.isString('assetData', assetData); assert.isBigNumber('amount', amount); - const self = (this as any) as ForwarderContract; - const abiEncodedTransactionData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [ - assetData, - amount, - ]); + const self = this as any as ForwarderContract; + const abiEncodedTransactionData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData, + amount + ]); return abiEncodedTransactionData; }, }; public owner = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -555,7 +394,7 @@ export class ForwarderContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ForwarderContract; + const self = this as any as ForwarderContract; const encodedData = self._strictEncodeArguments('owner()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -565,125 +404,76 @@ export class ForwarderContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as ForwarderContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as ForwarderContract; const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); return abiEncodedTransactionData; }, }; public marketSellOrdersWithEth = { async sendTransactionAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, signatures: string[], - feeOrders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, feeSignatures: string[], feePercentage: BigNumber, feeRecipient: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isArray('signatures', signatures); - assert.isArray('feeOrders', feeOrders); - assert.isArray('feeSignatures', feeSignatures); - assert.isBigNumber('feePercentage', feePercentage); - assert.isString('feeRecipient', feeRecipient); - const self = (this as any) as ForwarderContract; - const encodedData = self._strictEncodeArguments( - 'marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', - [orders, signatures, feeOrders, feeSignatures, feePercentage, feeRecipient.toLowerCase()], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.marketSellOrdersWithEth.estimateGasAsync.bind( - self, - orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase(), - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isArray('orders', orders); + assert.isArray('signatures', signatures); + assert.isArray('feeOrders', feeOrders); + assert.isArray('feeSignatures', feeSignatures); + assert.isBigNumber('feePercentage', feePercentage); + assert.isString('feeRecipient', feeRecipient); + const self = this as any as ForwarderContract; + const encodedData = self._strictEncodeArguments('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.marketSellOrdersWithEth.estimateGasAsync.bind( + self, + orders, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, signatures: string[], - feeOrders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, feeSignatures: string[], feePercentage: BigNumber, feeRecipient: string, @@ -691,145 +481,80 @@ export class ForwarderContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isArray('signatures', signatures); - assert.isArray('feeOrders', feeOrders); - assert.isArray('feeSignatures', feeSignatures); - assert.isBigNumber('feePercentage', feePercentage); - assert.isString('feeRecipient', feeRecipient); - const self = (this as any) as ForwarderContract; - const txHashPromise = self.marketSellOrdersWithEth.sendTransactionAsync( - orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase(), - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isArray('signatures', signatures); + assert.isArray('feeOrders', feeOrders); + assert.isArray('feeSignatures', feeSignatures); + assert.isBigNumber('feePercentage', feePercentage); + assert.isString('feeRecipient', feeRecipient); + const self = this as any as ForwarderContract; + const txHashPromise = self.marketSellOrdersWithEth.sendTransactionAsync(orders, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, signatures: string[], - feeOrders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, feeSignatures: string[], feePercentage: BigNumber, feeRecipient: string, txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isArray('signatures', signatures); - assert.isArray('feeOrders', feeOrders); - assert.isArray('feeSignatures', feeSignatures); - assert.isBigNumber('feePercentage', feePercentage); - assert.isString('feeRecipient', feeRecipient); - const self = (this as any) as ForwarderContract; - const encodedData = self._strictEncodeArguments( - 'marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', - [orders, signatures, feeOrders, feeSignatures, feePercentage, feeRecipient.toLowerCase()], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isArray('signatures', signatures); + assert.isArray('feeOrders', feeOrders); + assert.isArray('feeSignatures', feeSignatures); + assert.isBigNumber('feePercentage', feePercentage); + assert.isString('feeRecipient', feeRecipient); + const self = this as any as ForwarderContract; + const encodedData = self._strictEncodeArguments('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, signatures: string[], - feeOrders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, feeSignatures: string[], feePercentage: BigNumber, feeRecipient: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise< - [ - { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }, - { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - } - ] + ): Promise<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}] > { assert.isArray('orders', orders); assert.isArray('signatures', signatures); @@ -845,11 +570,14 @@ export class ForwarderContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ForwarderContract; - const encodedData = self._strictEncodeArguments( - 'marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', - [orders, signatures, feeOrders, feeSignatures, feePercentage, feeRecipient.toLowerCase()], - ); + const self = this as any as ForwarderContract; + const encodedData = self._strictEncodeArguments('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -858,103 +586,69 @@ export class ForwarderContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(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)', - ); + const abiEncoder = self._lookupAbiEncoder('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue< - [ - { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }, - { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - } - ] - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}] + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, - signatures: string[], - feeOrders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, - feeSignatures: string[], - feePercentage: BigNumber, - feeRecipient: string, - ): string { + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + signatures: string[], + feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + feeSignatures: string[], + feePercentage: BigNumber, + feeRecipient: string, + ): string { assert.isArray('orders', orders); assert.isArray('signatures', signatures); assert.isArray('feeOrders', feeOrders); assert.isArray('feeSignatures', feeSignatures); assert.isBigNumber('feePercentage', feePercentage); assert.isString('feeRecipient', feeRecipient); - const self = (this as any) as ForwarderContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', - [orders, signatures, feeOrders, feeSignatures, feePercentage, feeRecipient.toLowerCase()], - ); + const self = this as any as ForwarderContract; + const abiEncodedTransactionData = self._strictEncodeArguments('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public transferOwnership = { - async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as ForwarderContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + newOwner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('newOwner', newOwner); + const self = this as any as ForwarderContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferOwnership.estimateGasAsync.bind( + self, + newOwner.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( newOwner: string, @@ -962,41 +656,51 @@ export class ForwarderContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('newOwner', newOwner); - const self = (this as any) as ForwarderContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('newOwner', newOwner); + const self = this as any as ForwarderContract; + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as ForwarderContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + newOwner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('newOwner', newOwner); + const self = this as any as ForwarderContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + newOwner: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1006,8 +710,9 @@ export class ForwarderContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ForwarderContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const self = this as any as ForwarderContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1016,35 +721,35 @@ export class ForwarderContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(newOwner: string): string { + getABIEncodedTransactionData( + newOwner: string, + ): string { assert.isString('newOwner', newOwner); - const self = (this as any) as ForwarderContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ - newOwner.toLowerCase(), - ]); + const self = this as any as ForwarderContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); return abiEncodedTransactionData; }, }; - public static async deployFrom0xArtifactAsync( +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, - _exchange: string, - _zrxAssetData: string, - _wethAssetData: string, + logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + _exchange: string, + _zrxAssetData: string, + _wethAssetData: string, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -1057,20 +762,11 @@ export class ForwarderContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); - return ForwarderContract.deployAsync( - bytecode, - abi, - provider, - txDefaults, - logDecodeDependenciesAbiOnly, - _exchange, - _zrxAssetData, - _wethAssetData, - ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); + return ForwarderContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, _exchange, +_zrxAssetData, +_wethAssetData +); } public static async deployAsync( bytecode: string, @@ -1078,9 +774,9 @@ export class ForwarderContract extends BaseContract { supportedProvider: SupportedProvider, txDefaults: Partial, logDecodeDependencies: { [contractName: string]: ContractAbi }, - _exchange: string, - _zrxAssetData: string, - _wethAssetData: string, + _exchange: string, + _zrxAssetData: string, + _wethAssetData: string, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -1090,17 +786,26 @@ export class ForwarderContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_exchange, _zrxAssetData, _wethAssetData] = BaseContract._formatABIDataItemList( + [_exchange, +_zrxAssetData, +_wethAssetData +] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [_exchange, _zrxAssetData, _wethAssetData], + [_exchange, +_zrxAssetData, +_wethAssetData +], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_exchange, _zrxAssetData, _wethAssetData]); + const txData = deployInfo.encode(bytecode, [_exchange, +_zrxAssetData, +_wethAssetData +]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -1108,22 +813,21 @@ export class ForwarderContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`Forwarder successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ForwarderContract( - txReceipt.contractAddress as string, - provider, - txDefaults, - logDecodeDependencies, - ); - contractInstance.constructorArgs = [_exchange, _zrxAssetData, _wethAssetData]; + const contractInstance = new ForwarderContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); + contractInstance.constructorArgs = [_exchange, +_zrxAssetData, +_wethAssetData +]; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: false, inputs: [ { @@ -1178,7 +882,7 @@ export class ForwarderContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'makerAssetFillAmount', @@ -1240,7 +944,7 @@ export class ForwarderContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'feeSignatures', @@ -1277,7 +981,7 @@ export class ForwarderContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, { name: 'feeOrderFillResults', @@ -1299,14 +1003,14 @@ export class ForwarderContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, ], payable: true, stateMutability: 'payable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1319,14 +1023,16 @@ export class ForwarderContract extends BaseContract { }, ], name: 'withdrawAsset', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'owner', outputs: [ { @@ -1338,7 +1044,7 @@ export class ForwarderContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1393,7 +1099,7 @@ export class ForwarderContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'signatures', @@ -1451,7 +1157,7 @@ export class ForwarderContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'feeSignatures', @@ -1488,7 +1194,7 @@ export class ForwarderContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, { name: 'feeOrderFillResults', @@ -1510,14 +1216,14 @@ export class ForwarderContract extends BaseContract { name: 'takerFeePaid', type: 'uint256', }, - ], + ] }, ], payable: true, stateMutability: 'payable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1526,12 +1232,13 @@ export class ForwarderContract extends BaseContract { }, ], name: 'transferOwnership', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { inputs: [ { name: '_exchange', @@ -1546,14 +1253,17 @@ export class ForwarderContract extends BaseContract { type: 'bytes', }, ], - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'constructor', }, - { - inputs: [], - outputs: [], + { + inputs: [ + ], + outputs: [ + ], payable: true, stateMutability: 'payable', type: 'fallback', @@ -1561,16 +1271,11 @@ export class ForwarderContract extends BaseContract { ] as ContractAbi; return abi; } - constructor( - address: string, - supportedProvider: SupportedProvider, - txDefaults?: Partial, - logDecodeDependencies?: { [contractName: string]: ContractAbi }, - ) { + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { super('Forwarder', ForwarderContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 13b92cc118..0f9485156a 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 @@ -1,7 +1,7 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract'; +import { BaseContract,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -23,30 +23,38 @@ import { assert } from '@0x/assert'; import * as ethers from 'ethers'; // tslint:enable:no-unused-variable + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class IAssetProxyContract extends BaseContract { public addAuthorizedAddress = { - async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.addAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + target: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('target', target); + const self = this as any as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.addAuthorizedAddress.estimateGasAsync.bind( + self, + target.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -54,41 +62,51 @@ export class IAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = (this as any) as IAssetProxyContract; - const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + const self = this as any as IAssetProxyContract; + const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + target: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('target', target); + const self = this as any as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + target: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('target', target); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -98,8 +116,9 @@ export class IAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); + const self = this as any as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -108,47 +127,54 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(target: string): string { + getABIEncodedTransactionData( + target: string, + ): string { assert.isString('target', target); - const self = (this as any) as IAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [ - target.toLowerCase(), - ]); + const self = this as any as IAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public removeAuthorizedAddress = { - async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + target: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('target', target); + const self = this as any as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeAuthorizedAddress.estimateGasAsync.bind( + self, + target.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -156,41 +182,51 @@ export class IAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = (this as any) as IAssetProxyContract; - const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + const self = this as any as IAssetProxyContract; + const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + target: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('target', target); + const self = this as any as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + target: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('target', target); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -200,8 +236,9 @@ export class IAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); + const self = this as any as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -210,24 +247,24 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(target: string): string { + getABIEncodedTransactionData( + target: string, + ): string { assert.isString('target', target); - const self = (this as any) as IAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [ - target.toLowerCase(), - ]); + const self = this as any as IAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() + ]); return abiEncodedTransactionData; }, }; @@ -235,30 +272,33 @@ export class IAssetProxyContract extends BaseContract { async sendTransactionAsync( target: string, index: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = this as any as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), + index + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind( + self, target.toLowerCase(), - index, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(self, target.toLowerCase(), index), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + index + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -267,59 +307,57 @@ export class IAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as IAssetProxyContract; - const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync( - target.toLowerCase(), - index, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = this as any as IAssetProxyContract; + const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync(target.toLowerCase(), + index + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( target: string, index: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target.toLowerCase(), - index, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = this as any as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), + index + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( target: string, index: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('target', target); assert.isBigNumber('index', index); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -330,11 +368,10 @@ export class IAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target.toLowerCase(), - index, - ]); + const self = this as any as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), + index + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -343,26 +380,27 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(target: string, index: BigNumber): string { + getABIEncodedTransactionData( + target: string, + index: BigNumber, + ): string { assert.isString('target', target); assert.isBigNumber('index', index); - const self = (this as any) as IAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'removeAuthorizedAddressAtIndex(address,uint256)', - [target.toLowerCase(), index], - ); + const self = this as any as IAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), + index + ]); return abiEncodedTransactionData; }, }; @@ -372,34 +410,39 @@ export class IAssetProxyContract extends BaseContract { from: string, to: string, amount: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('assetData', assetData); - assert.isString('from', from); - assert.isString('to', to); - assert.isBigNumber('amount', amount); - const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [ + assert.isString('assetData', assetData); + assert.isString('from', from); + assert.isString('to', to); + assert.isBigNumber('amount', amount); + const self = this as any as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [assetData, + from.toLowerCase(), + to.toLowerCase(), + amount + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferFrom.estimateGasAsync.bind( + self, assetData, from.toLowerCase(), to.toLowerCase(), - amount, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind(self, assetData, from.toLowerCase(), to.toLowerCase(), amount), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + amount + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( assetData: string, @@ -410,29 +453,27 @@ export class IAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('assetData', assetData); - assert.isString('from', from); - assert.isString('to', to); - assert.isBigNumber('amount', amount); - const self = (this as any) as IAssetProxyContract; - const txHashPromise = self.transferFrom.sendTransactionAsync( - assetData, - from.toLowerCase(), - to.toLowerCase(), - amount, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('assetData', assetData); + assert.isString('from', from); + assert.isString('to', to); + assert.isBigNumber('amount', amount); + const self = this as any as IAssetProxyContract; + const txHashPromise = self.transferFrom.sendTransactionAsync(assetData, + from.toLowerCase(), + to.toLowerCase(), + amount + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( assetData: string, @@ -441,31 +482,30 @@ export class IAssetProxyContract extends BaseContract { amount: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('assetData', assetData); - assert.isString('from', from); - assert.isString('to', to); - assert.isBigNumber('amount', amount); - const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [ - assetData, - from.toLowerCase(), - to.toLowerCase(), - amount, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('assetData', assetData); + assert.isString('from', from); + assert.isString('to', to); + assert.isBigNumber('amount', amount); + const self = this as any as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [assetData, + from.toLowerCase(), + to.toLowerCase(), + amount + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( assetData: string, @@ -474,7 +514,8 @@ export class IAssetProxyContract extends BaseContract { amount: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('assetData', assetData); assert.isString('from', from); assert.isString('to', to); @@ -487,13 +528,12 @@ export class IAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [ - assetData, - from.toLowerCase(), - to.toLowerCase(), - amount, - ]); + const self = this as any as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [assetData, + from.toLowerCase(), + to.toLowerCase(), + amount + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -502,33 +542,42 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(bytes,address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(assetData: string, from: string, to: string, amount: BigNumber): string { + getABIEncodedTransactionData( + assetData: string, + from: string, + to: string, + amount: BigNumber, + ): string { assert.isString('assetData', assetData); assert.isString('from', from); assert.isString('to', to); assert.isBigNumber('amount', amount); - const self = (this as any) as IAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'transferFrom(bytes,address,address,uint256)', - [assetData, from.toLowerCase(), to.toLowerCase(), amount], - ); + const self = this as any as IAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [assetData, + from.toLowerCase(), + to.toLowerCase(), + amount + ]); return abiEncodedTransactionData; }, }; public getProxyId = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -537,7 +586,7 @@ export class IAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as IAssetProxyContract; + const self = this as any as IAssetProxyContract; const encodedData = self._strictEncodeArguments('getProxyId()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -547,26 +596,30 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getProxyId()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as IAssetProxyContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as IAssetProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('getProxyId()', []); return abiEncodedTransactionData; }, }; public getAuthorizedAddresses = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -575,7 +628,7 @@ export class IAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as IAssetProxyContract; + const self = this as any as IAssetProxyContract; const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -585,44 +638,51 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as IAssetProxyContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as IAssetProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('getAuthorizedAddresses()', []); return abiEncodedTransactionData; }, }; public transferOwnership = { - async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + newOwner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('newOwner', newOwner); + const self = this as any as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferOwnership.estimateGasAsync.bind( + self, + newOwner.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( newOwner: string, @@ -630,41 +690,51 @@ export class IAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('newOwner', newOwner); - const self = (this as any) as IAssetProxyContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('newOwner', newOwner); + const self = this as any as IAssetProxyContract; + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + newOwner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('newOwner', newOwner); + const self = this as any as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + newOwner: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -674,8 +744,9 @@ export class IAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const self = this as any as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -684,32 +755,32 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(newOwner: string): string { + getABIEncodedTransactionData( + newOwner: string, + ): string { assert.isString('newOwner', newOwner); - const self = (this as any) as IAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ - newOwner.toLowerCase(), - ]); + const self = this as any as IAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); return abiEncodedTransactionData; }, }; - public static async deployFrom0xArtifactAsync( +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -722,11 +793,8 @@ export class IAssetProxyContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); - return IAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); + return IAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, ); } public static async deployAsync( bytecode: string, @@ -743,13 +811,17 @@ export class IAssetProxyContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); + [] = BaseContract._formatABIDataItemList( + constructorAbi.inputs, + [], + BaseContract._bigNumberToString, + ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -757,22 +829,18 @@ export class IAssetProxyContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`IAssetProxy successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new IAssetProxyContract( - txReceipt.contractAddress as string, - provider, - txDefaults, - logDecodeDependencies, - ); + const contractInstance = new IAssetProxyContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); contractInstance.constructorArgs = []; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: false, inputs: [ { @@ -781,12 +849,13 @@ export class IAssetProxyContract extends BaseContract { }, ], name: 'addAuthorizedAddress', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -795,12 +864,13 @@ export class IAssetProxyContract extends BaseContract { }, ], name: 'removeAuthorizedAddress', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -813,12 +883,13 @@ export class IAssetProxyContract extends BaseContract { }, ], name: 'removeAuthorizedAddressAtIndex', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -839,14 +910,16 @@ export class IAssetProxyContract extends BaseContract { }, ], name: 'transferFrom', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'getProxyId', outputs: [ { @@ -858,9 +931,10 @@ export class IAssetProxyContract extends BaseContract { stateMutability: 'pure', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'getAuthorizedAddresses', outputs: [ { @@ -872,7 +946,7 @@ export class IAssetProxyContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -881,7 +955,8 @@ export class IAssetProxyContract extends BaseContract { }, ], name: 'transferOwnership', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', @@ -889,16 +964,11 @@ export class IAssetProxyContract extends BaseContract { ] as ContractAbi; return abi; } - constructor( - address: string, - supportedProvider: SupportedProvider, - txDefaults?: Partial, - logDecodeDependencies?: { [contractName: string]: ContractAbi }, - ) { + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { super('IAssetProxy', IAssetProxyContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 fd016262d4..a579445d03 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts @@ -1,7 +1,7 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract'; +import { BaseContract,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -23,6 +23,7 @@ import { assert } from '@0x/assert'; import * as ethers from 'ethers'; // tslint:enable:no-unused-variable + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name @@ -34,7 +35,8 @@ export class IValidatorContract extends BaseContract { signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('hash', hash); assert.isString('signerAddress', signerAddress); assert.isString('signature', signature); @@ -46,12 +48,11 @@ export class IValidatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as IValidatorContract; - const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [ - hash, - signerAddress.toLowerCase(), - signature, - ]); + const self = this as any as IValidatorContract; + const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [hash, + signerAddress.toLowerCase(), + signature + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -60,36 +61,38 @@ export class IValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isValidSignature(bytes32,address,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(hash: string, signerAddress: string, signature: string): string { + getABIEncodedTransactionData( + hash: string, + signerAddress: string, + signature: string, + ): string { assert.isString('hash', hash); assert.isString('signerAddress', signerAddress); assert.isString('signature', signature); - const self = (this as any) as IValidatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [ - hash, - signerAddress.toLowerCase(), - signature, - ]); + const self = this as any as IValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [hash, + signerAddress.toLowerCase(), + signature + ]); return abiEncodedTransactionData; }, }; - public static async deployFrom0xArtifactAsync( +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -102,11 +105,8 @@ export class IValidatorContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); - return IValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); + return IValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, ); } public static async deployAsync( bytecode: string, @@ -123,13 +123,17 @@ export class IValidatorContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); + [] = BaseContract._formatABIDataItemList( + constructorAbi.inputs, + [], + BaseContract._bigNumberToString, + ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -137,22 +141,18 @@ export class IValidatorContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`IValidator successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new IValidatorContract( - txReceipt.contractAddress as string, - provider, - txDefaults, - logDecodeDependencies, - ); + const contractInstance = new IValidatorContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); contractInstance.constructorArgs = []; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -182,16 +182,11 @@ export class IValidatorContract extends BaseContract { ] as ContractAbi; return abi; } - constructor( - address: string, - supportedProvider: SupportedProvider, - txDefaults?: Partial, - logDecodeDependencies?: { [contractName: string]: ContractAbi }, - ) { + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { super('IValidator', IValidatorContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 20a8250ba8..df213acdc8 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts @@ -1,7 +1,7 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract'; +import { BaseContract,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -23,6 +23,7 @@ import { assert } from '@0x/assert'; import * as ethers from 'ethers'; // tslint:enable:no-unused-variable + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name @@ -33,7 +34,8 @@ export class IWalletContract extends BaseContract { signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('hash', hash); assert.isString('signature', signature); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -44,8 +46,10 @@ export class IWalletContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as IWalletContract; - const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,bytes)', [hash, signature]); + const self = this as any as IWalletContract; + const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,bytes)', [hash, + signature + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -54,34 +58,35 @@ export class IWalletContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isValidSignature(bytes32,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(hash: string, signature: string): string { + getABIEncodedTransactionData( + hash: string, + signature: string, + ): string { assert.isString('hash', hash); assert.isString('signature', signature); - const self = (this as any) as IWalletContract; - const abiEncodedTransactionData = self._strictEncodeArguments('isValidSignature(bytes32,bytes)', [ - hash, - signature, - ]); + const self = this as any as IWalletContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isValidSignature(bytes32,bytes)', [hash, + signature + ]); return abiEncodedTransactionData; }, }; - public static async deployFrom0xArtifactAsync( +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -94,11 +99,8 @@ export class IWalletContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); - return IWalletContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); + return IWalletContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, ); } public static async deployAsync( bytecode: string, @@ -115,13 +117,17 @@ export class IWalletContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); + [] = BaseContract._formatABIDataItemList( + constructorAbi.inputs, + [], + BaseContract._bigNumberToString, + ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -129,22 +135,18 @@ export class IWalletContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`IWallet successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new IWalletContract( - txReceipt.contractAddress as string, - provider, - txDefaults, - logDecodeDependencies, - ); + const contractInstance = new IWalletContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); contractInstance.constructorArgs = []; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -170,16 +172,11 @@ export class IWalletContract extends BaseContract { ] as ContractAbi; return abi; } - constructor( - address: string, - supportedProvider: SupportedProvider, - txDefaults?: Partial, - logDecodeDependencies?: { [contractName: string]: ContractAbi }, - ) { + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { super('IWallet', IWalletContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 92628c0c03..47aca21b22 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 @@ -1,14 +1,11 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { - BaseContract, +import { BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager, - PromiseWithTransactionHash, -} from '@0x/base-contract'; + SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -57,12 +54,18 @@ export interface MultiAssetProxyAssetProxyRegisteredEventArgs extends DecodedLog assetProxy: string; } + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class MultiAssetProxyContract extends BaseContract { public assetProxies = { - async callAsync(index_0: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + index_0: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -72,8 +75,9 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0]); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0 + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -82,45 +86,54 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('assetProxies(bytes4)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: string): string { + getABIEncodedTransactionData( + index_0: string, + ): string { assert.isString('index_0', index_0); - const self = (this as any) as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0]); + const self = this as any as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0 + ]); return abiEncodedTransactionData; }, }; public addAuthorizedAddress = { - async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.addAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + target: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('target', target); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.addAuthorizedAddress.estimateGasAsync.bind( + self, + target.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -128,41 +141,51 @@ export class MultiAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = (this as any) as MultiAssetProxyContract; - const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + const self = this as any as MultiAssetProxyContract; + const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + target: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('target', target); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + target: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('target', target); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -172,8 +195,9 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -182,24 +206,24 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(target: string): string { + getABIEncodedTransactionData( + target: string, + ): string { assert.isString('target', target); - const self = (this as any) as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [ - target.toLowerCase(), - ]); + const self = this as any as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() + ]); return abiEncodedTransactionData; }, }; @@ -208,7 +232,8 @@ export class MultiAssetProxyContract extends BaseContract { index_0: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -218,8 +243,9 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0]); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0 + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -228,22 +254,24 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: BigNumber): string { + getABIEncodedTransactionData( + index_0: BigNumber, + ): string { assert.isBigNumber('index_0', index_0); - const self = (this as any) as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('authorities(uint256)', [index_0]); + const self = this as any as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('authorities(uint256)', [index_0 + ]); return abiEncodedTransactionData; }, }; @@ -252,7 +280,8 @@ export class MultiAssetProxyContract extends BaseContract { assetProxyId: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('assetProxyId', assetProxyId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -262,8 +291,9 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId]); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -272,45 +302,54 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAssetProxy(bytes4)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(assetProxyId: string): string { + getABIEncodedTransactionData( + assetProxyId: string, + ): string { assert.isString('assetProxyId', assetProxyId); - const self = (this as any) as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId]); + const self = this as any as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId + ]); return abiEncodedTransactionData; }, }; public removeAuthorizedAddress = { - async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + target: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('target', target); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeAuthorizedAddress.estimateGasAsync.bind( + self, + target.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -318,41 +357,51 @@ export class MultiAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = (this as any) as MultiAssetProxyContract; - const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + const self = this as any as MultiAssetProxyContract; + const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { - assert.isString('target', target); - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + target: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('target', target); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + target: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('target', target); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -362,8 +411,9 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -372,29 +422,33 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(target: string): string { + getABIEncodedTransactionData( + target: string, + ): string { assert.isString('target', target); - const self = (this as any) as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [ - target.toLowerCase(), - ]); + const self = this as any as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public owner = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -403,7 +457,7 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as MultiAssetProxyContract; + const self = this as any as MultiAssetProxyContract; const encodedData = self._strictEncodeArguments('owner()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -413,20 +467,20 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as MultiAssetProxyContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as MultiAssetProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); return abiEncodedTransactionData; }, @@ -435,30 +489,33 @@ export class MultiAssetProxyContract extends BaseContract { async sendTransactionAsync( target: string, index: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), + index + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind( + self, target.toLowerCase(), - index, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(self, target.toLowerCase(), index), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + index + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -467,59 +524,57 @@ export class MultiAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as MultiAssetProxyContract; - const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync( - target.toLowerCase(), - index, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = this as any as MultiAssetProxyContract; + const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync(target.toLowerCase(), + index + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( target: string, index: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target.toLowerCase(), - index, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), + index + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( target: string, index: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('target', target); assert.isBigNumber('index', index); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -530,11 +585,10 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ - target.toLowerCase(), - index, - ]); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), + index + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -543,31 +597,36 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(target: string, index: BigNumber): string { + getABIEncodedTransactionData( + target: string, + index: BigNumber, + ): string { assert.isString('target', target); assert.isBigNumber('index', index); - const self = (this as any) as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'removeAuthorizedAddressAtIndex(address,uint256)', - [target.toLowerCase(), index], - ); + const self = this as any as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), + index + ]); return abiEncodedTransactionData; }, }; public getProxyId = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -576,7 +635,7 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as MultiAssetProxyContract; + const self = this as any as MultiAssetProxyContract; const encodedData = self._strictEncodeArguments('getProxyId()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -586,20 +645,20 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getProxyId()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as MultiAssetProxyContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as MultiAssetProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('getProxyId()', []); return abiEncodedTransactionData; }, @@ -609,7 +668,8 @@ export class MultiAssetProxyContract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -619,8 +679,9 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase()]); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -629,47 +690,54 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorized(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: string): string { + getABIEncodedTransactionData( + index_0: string, + ): string { assert.isString('index_0', index_0); - const self = (this as any) as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [ - index_0.toLowerCase(), - ]); + const self = this as any as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public registerAssetProxy = { - async sendTransactionAsync(assetProxy: string, txData?: Partial | undefined): Promise { - assert.isString('assetProxy', assetProxy); - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.registerAssetProxy.estimateGasAsync.bind(self, assetProxy.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + assetProxy: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('assetProxy', assetProxy); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.registerAssetProxy.estimateGasAsync.bind( + self, + assetProxy.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( assetProxy: string, @@ -677,45 +745,51 @@ export class MultiAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('assetProxy', assetProxy); - const self = (this as any) as MultiAssetProxyContract; - const txHashPromise = self.registerAssetProxy.sendTransactionAsync(assetProxy.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('assetProxy', assetProxy); + const self = this as any as MultiAssetProxyContract; + const txHashPromise = self.registerAssetProxy.sendTransactionAsync(assetProxy.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(assetProxy: string, txData?: Partial | undefined): Promise { - assert.isString('assetProxy', assetProxy); - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + assetProxy: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('assetProxy', assetProxy); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( assetProxy: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('assetProxy', assetProxy); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -725,8 +799,9 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase()]); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -735,29 +810,33 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(assetProxy: string): string { + getABIEncodedTransactionData( + assetProxy: string, + ): string { assert.isString('assetProxy', assetProxy); - const self = (this as any) as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address)', [ - assetProxy.toLowerCase(), - ]); + const self = this as any as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public getAuthorizedAddresses = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -766,7 +845,7 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as MultiAssetProxyContract; + const self = this as any as MultiAssetProxyContract; const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -776,44 +855,51 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as MultiAssetProxyContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as MultiAssetProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('getAuthorizedAddresses()', []); return abiEncodedTransactionData; }, }; public transferOwnership = { - async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + newOwner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('newOwner', newOwner); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferOwnership.estimateGasAsync.bind( + self, + newOwner.toLowerCase() + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( newOwner: string, @@ -821,41 +907,51 @@ export class MultiAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('newOwner', newOwner); - const self = (this as any) as MultiAssetProxyContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('newOwner', newOwner); + const self = this as any as MultiAssetProxyContract; + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase() + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { - assert.isString('newOwner', newOwner); - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + newOwner: string, + txData?: Partial | undefined, + ): Promise { + assert.isString('newOwner', newOwner); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + newOwner: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -865,8 +961,9 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const self = this as any as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -875,33 +972,33 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(newOwner: string): string { + getABIEncodedTransactionData( + newOwner: string, + ): string { assert.isString('newOwner', newOwner); - const self = (this as any) as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ - newOwner.toLowerCase(), - ]); + const self = this as any as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() + ]); return abiEncodedTransactionData; }, }; - private readonly _subscriptionManager: SubscriptionManager; - public static async deployFrom0xArtifactAsync( +private readonly _subscriptionManager: SubscriptionManager; +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -914,11 +1011,8 @@ export class MultiAssetProxyContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); - return MultiAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); + return MultiAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, ); } public static async deployAsync( bytecode: string, @@ -935,13 +1029,17 @@ export class MultiAssetProxyContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); + [] = BaseContract._formatABIDataItemList( + constructorAbi.inputs, + [], + BaseContract._bigNumberToString, + ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -949,22 +1047,18 @@ export class MultiAssetProxyContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`MultiAssetProxy successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new MultiAssetProxyContract( - txReceipt.contractAddress as string, - provider, - txDefaults, - logDecodeDependencies, - ); + const contractInstance = new MultiAssetProxyContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); contractInstance.constructorArgs = []; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -983,7 +1077,7 @@ export class MultiAssetProxyContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -992,12 +1086,13 @@ export class MultiAssetProxyContract extends BaseContract { }, ], name: 'addAuthorizedAddress', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1016,7 +1111,7 @@ export class MultiAssetProxyContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1035,7 +1130,7 @@ export class MultiAssetProxyContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1044,14 +1139,16 @@ export class MultiAssetProxyContract extends BaseContract { }, ], name: 'removeAuthorizedAddress', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'owner', outputs: [ { @@ -1063,7 +1160,7 @@ export class MultiAssetProxyContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1076,14 +1173,16 @@ export class MultiAssetProxyContract extends BaseContract { }, ], name: 'removeAuthorizedAddressAtIndex', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'getProxyId', outputs: [ { @@ -1095,7 +1194,7 @@ export class MultiAssetProxyContract extends BaseContract { stateMutability: 'pure', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1114,7 +1213,7 @@ export class MultiAssetProxyContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1123,14 +1222,16 @@ export class MultiAssetProxyContract extends BaseContract { }, ], name: 'registerAssetProxy', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'getAuthorizedAddresses', outputs: [ { @@ -1142,7 +1243,7 @@ export class MultiAssetProxyContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1151,19 +1252,22 @@ export class MultiAssetProxyContract extends BaseContract { }, ], name: 'transferOwnership', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { - inputs: [], - outputs: [], + { + inputs: [ + ], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'fallback', }, - { + { anonymous: false, inputs: [ { @@ -1178,10 +1282,11 @@ export class MultiAssetProxyContract extends BaseContract { }, ], name: 'AuthorizedAddressAdded', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1196,10 +1301,11 @@ export class MultiAssetProxyContract extends BaseContract { }, ], name: 'AuthorizedAddressRemoved', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1214,7 +1320,8 @@ export class MultiAssetProxyContract extends BaseContract { }, ], name: 'AssetProxyRegistered', - outputs: [], + outputs: [ + ], type: 'event', }, ] as ContractAbi; @@ -1288,27 +1395,15 @@ export class MultiAssetProxyContract extends BaseContract { ); return logs; } - constructor( - address: string, - supportedProvider: SupportedProvider, - txDefaults?: Partial, - logDecodeDependencies?: { [contractName: string]: ContractAbi }, - ) { - super( - 'MultiAssetProxy', - MultiAssetProxyContract.ABI(), - address, - supportedProvider, - txDefaults, - logDecodeDependencies, - ); + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + super('MultiAssetProxy', MultiAssetProxyContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( MultiAssetProxyContract.ABI(), this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 2183ee494f..3f2843d6ed 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts @@ -1,7 +1,7 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract'; +import { BaseContract,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -23,44 +23,20 @@ import { assert } from '@0x/assert'; import * as ethers from 'ethers'; // tslint:enable:no-unused-variable + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class OrderValidatorContract extends BaseContract { public getOrderAndTraderInfo = { async callAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, takerAddress: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise< - [ - { orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }, - { - makerBalance: BigNumber; - makerAllowance: BigNumber; - takerBalance: BigNumber; - takerAllowance: BigNumber; - makerZrxBalance: BigNumber; - makerZrxAllowance: BigNumber; - takerZrxBalance: BigNumber; - takerZrxAllowance: BigNumber; - } - ] + ): Promise<[{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}, {makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}] > { + assert.isString('takerAddress', takerAddress); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -70,11 +46,10 @@ export class OrderValidatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as OrderValidatorContract; - const encodedData = self._strictEncodeArguments( - 'getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', - [order, takerAddress.toLowerCase()], - ); + const self = this as any as OrderValidatorContract; + const encodedData = self._strictEncodeArguments('getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', [order, + takerAddress.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -83,57 +58,27 @@ export class OrderValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', - ); + const abiEncoder = self._lookupAbiEncoder('getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue< - [ - { orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }, - { - makerBalance: BigNumber; - makerAllowance: BigNumber; - takerBalance: BigNumber; - takerAllowance: BigNumber; - makerZrxBalance: BigNumber; - makerZrxAllowance: BigNumber; - takerZrxBalance: BigNumber; - takerZrxAllowance: BigNumber; - } - ] - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<[{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}, {makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}] + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - takerAddress: string, - ): string { + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + takerAddress: string, + ): string { + assert.isString('takerAddress', takerAddress); - const self = (this as any) as OrderValidatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', - [order, takerAddress.toLowerCase()], - ); + const self = this as any as OrderValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', [order, + takerAddress.toLowerCase() + ]); return abiEncodedTransactionData; }, }; @@ -143,7 +88,8 @@ export class OrderValidatorContract extends BaseContract { assetData: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<[BigNumber, BigNumber]> { + ): Promise<[BigNumber, BigNumber] + > { assert.isString('target', target); assert.isString('assetData', assetData); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -154,11 +100,10 @@ export class OrderValidatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as OrderValidatorContract; - const encodedData = self._strictEncodeArguments('getBalanceAndAllowance(address,bytes)', [ - target.toLowerCase(), - assetData, - ]); + const self = this as any as OrderValidatorContract; + const encodedData = self._strictEncodeArguments('getBalanceAndAllowance(address,bytes)', [target.toLowerCase(), + assetData + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -167,62 +112,37 @@ export class OrderValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getBalanceAndAllowance(address,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<[BigNumber, BigNumber]>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<[BigNumber, BigNumber] + >(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(target: string, assetData: string): string { + getABIEncodedTransactionData( + target: string, + assetData: string, + ): string { assert.isString('target', target); assert.isString('assetData', assetData); - const self = (this as any) as OrderValidatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getBalanceAndAllowance(address,bytes)', [ - target.toLowerCase(), - assetData, - ]); + const self = this as any as OrderValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getBalanceAndAllowance(address,bytes)', [target.toLowerCase(), + assetData + ]); return abiEncodedTransactionData; }, }; public getOrdersAndTradersInfo = { async callAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAddresses: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise< - [ - Array<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }>, - Array<{ - makerBalance: BigNumber; - makerAllowance: BigNumber; - takerBalance: BigNumber; - takerAllowance: BigNumber; - makerZrxBalance: BigNumber; - makerZrxAllowance: BigNumber; - takerZrxBalance: BigNumber; - takerZrxAllowance: BigNumber; - }> - ] + ): Promise<[Array<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}>, Array<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}>] > { assert.isArray('orders', orders); assert.isArray('takerAddresses', takerAddresses); @@ -234,11 +154,10 @@ export class OrderValidatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as OrderValidatorContract; - const encodedData = self._strictEncodeArguments( - 'getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', - [orders, takerAddresses], - ); + const self = this as any as OrderValidatorContract; + const encodedData = self._strictEncodeArguments('getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', [orders, + takerAddresses + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -247,91 +166,37 @@ export class OrderValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', - ); + const abiEncoder = self._lookupAbiEncoder('getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue< - [ - Array<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }>, - Array<{ - makerBalance: BigNumber; - makerAllowance: BigNumber; - takerBalance: BigNumber; - takerAllowance: BigNumber; - makerZrxBalance: BigNumber; - makerZrxAllowance: BigNumber; - takerZrxBalance: BigNumber; - takerZrxAllowance: BigNumber; - }> - ] - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<[Array<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}>, Array<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}>] + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, - takerAddresses: string[], - ): string { + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + takerAddresses: string[], + ): string { assert.isArray('orders', orders); assert.isArray('takerAddresses', takerAddresses); - const self = (this as any) as OrderValidatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', - [orders, takerAddresses], - ); + const self = this as any as OrderValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', [orders, + takerAddresses + ]); return abiEncodedTransactionData; }, }; public getTradersInfo = { async callAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAddresses: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise< - Array<{ - makerBalance: BigNumber; - makerAllowance: BigNumber; - takerBalance: BigNumber; - takerAllowance: BigNumber; - makerZrxBalance: BigNumber; - makerZrxAllowance: BigNumber; - takerZrxBalance: BigNumber; - takerZrxAllowance: BigNumber; - }> + ): Promise > { assert.isArray('orders', orders); assert.isArray('takerAddresses', takerAddresses); @@ -343,11 +208,10 @@ export class OrderValidatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as OrderValidatorContract; - const encodedData = self._strictEncodeArguments( - 'getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', - [orders, takerAddresses], - ); + const self = this as any as OrderValidatorContract; + const encodedData = self._strictEncodeArguments('getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', [orders, + takerAddresses + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -356,55 +220,27 @@ export class OrderValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', - ); + const abiEncoder = self._lookupAbiEncoder('getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue< - Array<{ - makerBalance: BigNumber; - makerAllowance: BigNumber; - takerBalance: BigNumber; - takerAllowance: BigNumber; - makerZrxBalance: BigNumber; - makerZrxAllowance: BigNumber; - takerZrxBalance: BigNumber; - takerZrxAllowance: BigNumber; - }> - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, - takerAddresses: string[], - ): string { + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + takerAddresses: string[], + ): string { assert.isArray('orders', orders); assert.isArray('takerAddresses', takerAddresses); - const self = (this as any) as OrderValidatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', - [orders, takerAddresses], - ); + const self = this as any as OrderValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', [orders, + takerAddresses + ]); return abiEncodedTransactionData; }, }; @@ -414,7 +250,8 @@ export class OrderValidatorContract extends BaseContract { tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('token', token); assert.isBigNumber('tokenId', tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -425,11 +262,10 @@ export class OrderValidatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as OrderValidatorContract; - const encodedData = self._strictEncodeArguments('getERC721TokenOwner(address,uint256)', [ - token.toLowerCase(), - tokenId, - ]); + const self = this as any as OrderValidatorContract; + const encodedData = self._strictEncodeArguments('getERC721TokenOwner(address,uint256)', [token.toLowerCase(), + tokenId + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -438,26 +274,27 @@ export class OrderValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getERC721TokenOwner(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(token: string, tokenId: BigNumber): string { + getABIEncodedTransactionData( + token: string, + tokenId: BigNumber, + ): string { assert.isString('token', token); assert.isBigNumber('tokenId', tokenId); - const self = (this as any) as OrderValidatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getERC721TokenOwner(address,uint256)', [ - token.toLowerCase(), - tokenId, - ]); + const self = this as any as OrderValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getERC721TokenOwner(address,uint256)', [token.toLowerCase(), + tokenId + ]); return abiEncodedTransactionData; }, }; @@ -467,7 +304,8 @@ export class OrderValidatorContract extends BaseContract { assetData: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<[BigNumber[], BigNumber[]]> { + ): Promise<[BigNumber[], BigNumber[]] + > { assert.isString('target', target); assert.isArray('assetData', assetData); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -478,11 +316,10 @@ export class OrderValidatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as OrderValidatorContract; - const encodedData = self._strictEncodeArguments('getBalancesAndAllowances(address,bytes[])', [ - target.toLowerCase(), - assetData, - ]); + const self = this as any as OrderValidatorContract; + const encodedData = self._strictEncodeArguments('getBalancesAndAllowances(address,bytes[])', [target.toLowerCase(), + assetData + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -491,58 +328,39 @@ export class OrderValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getBalancesAndAllowances(address,bytes[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<[BigNumber[], BigNumber[]]>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<[BigNumber[], BigNumber[]] + >(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(target: string, assetData: string[]): string { + getABIEncodedTransactionData( + target: string, + assetData: string[], + ): string { assert.isString('target', target); assert.isArray('assetData', assetData); - const self = (this as any) as OrderValidatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getBalancesAndAllowances(address,bytes[])', [ - target.toLowerCase(), - assetData, - ]); + const self = this as any as OrderValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getBalancesAndAllowances(address,bytes[])', [target.toLowerCase(), + assetData + ]); return abiEncodedTransactionData; }, }; public getTraderInfo = { async callAsync( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, takerAddress: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{ - makerBalance: BigNumber; - makerAllowance: BigNumber; - takerBalance: BigNumber; - takerAllowance: BigNumber; - makerZrxBalance: BigNumber; - makerZrxAllowance: BigNumber; - takerZrxBalance: BigNumber; - takerZrxAllowance: BigNumber; - }> { + ): Promise<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber} + > { + assert.isString('takerAddress', takerAddress); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -552,11 +370,10 @@ export class OrderValidatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as OrderValidatorContract; - const encodedData = self._strictEncodeArguments( - 'getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', - [order, takerAddress.toLowerCase()], - ); + const self = this as any as OrderValidatorContract; + const encodedData = self._strictEncodeArguments('getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', [order, + takerAddress.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -565,62 +382,37 @@ export class OrderValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', - ); + const abiEncoder = self._lookupAbiEncoder('getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{ - makerBalance: BigNumber; - makerAllowance: BigNumber; - takerBalance: BigNumber; - takerAllowance: BigNumber; - makerZrxBalance: BigNumber; - makerZrxAllowance: BigNumber; - takerZrxBalance: BigNumber; - takerZrxAllowance: BigNumber; - }>(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber} + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - takerAddress: string, - ): string { + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + takerAddress: string, + ): string { + assert.isString('takerAddress', takerAddress); - const self = (this as any) as OrderValidatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', - [order, takerAddress.toLowerCase()], - ); + const self = this as any as OrderValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', [order, + takerAddress.toLowerCase() + ]); return abiEncodedTransactionData; }, }; - public static async deployFrom0xArtifactAsync( +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, - _exchange: string, - _zrxAssetData: string, + logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + _exchange: string, + _zrxAssetData: string, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -633,19 +425,10 @@ export class OrderValidatorContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); - return OrderValidatorContract.deployAsync( - bytecode, - abi, - provider, - txDefaults, - logDecodeDependenciesAbiOnly, - _exchange, - _zrxAssetData, - ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); + return OrderValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, _exchange, +_zrxAssetData +); } public static async deployAsync( bytecode: string, @@ -653,8 +436,8 @@ export class OrderValidatorContract extends BaseContract { supportedProvider: SupportedProvider, txDefaults: Partial, logDecodeDependencies: { [contractName: string]: ContractAbi }, - _exchange: string, - _zrxAssetData: string, + _exchange: string, + _zrxAssetData: string, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -664,17 +447,23 @@ export class OrderValidatorContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_exchange, _zrxAssetData] = BaseContract._formatABIDataItemList( + [_exchange, +_zrxAssetData +] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [_exchange, _zrxAssetData], + [_exchange, +_zrxAssetData +], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_exchange, _zrxAssetData]); + const txData = deployInfo.encode(bytecode, [_exchange, +_zrxAssetData +]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -682,22 +471,20 @@ export class OrderValidatorContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`OrderValidator successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new OrderValidatorContract( - txReceipt.contractAddress as string, - provider, - txDefaults, - logDecodeDependencies, - ); - contractInstance.constructorArgs = [_exchange, _zrxAssetData]; + const contractInstance = new OrderValidatorContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); + contractInstance.constructorArgs = [_exchange, +_zrxAssetData +]; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -752,7 +539,7 @@ export class OrderValidatorContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'takerAddress', @@ -777,7 +564,7 @@ export class OrderValidatorContract extends BaseContract { name: 'orderTakerAssetFilledAmount', type: 'uint256', }, - ], + ] }, { name: 'traderInfo', @@ -815,14 +602,14 @@ export class OrderValidatorContract extends BaseContract { name: 'takerZrxAllowance', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -849,7 +636,7 @@ export class OrderValidatorContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -904,7 +691,7 @@ export class OrderValidatorContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'takerAddresses', @@ -929,7 +716,7 @@ export class OrderValidatorContract extends BaseContract { name: 'orderTakerAssetFilledAmount', type: 'uint256', }, - ], + ] }, { name: 'tradersInfo', @@ -967,14 +754,14 @@ export class OrderValidatorContract extends BaseContract { name: 'takerZrxAllowance', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1029,7 +816,7 @@ export class OrderValidatorContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'takerAddresses', @@ -1074,14 +861,14 @@ export class OrderValidatorContract extends BaseContract { name: 'takerZrxAllowance', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1104,7 +891,7 @@ export class OrderValidatorContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1131,7 +918,7 @@ export class OrderValidatorContract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1186,7 +973,7 @@ export class OrderValidatorContract extends BaseContract { name: 'takerAssetData', type: 'bytes', }, - ], + ] }, { name: 'takerAddress', @@ -1231,14 +1018,14 @@ export class OrderValidatorContract extends BaseContract { name: 'takerZrxAllowance', type: 'uint256', }, - ], + ] }, ], payable: false, stateMutability: 'view', type: 'function', }, - { + { inputs: [ { name: '_exchange', @@ -1249,7 +1036,8 @@ export class OrderValidatorContract extends BaseContract { type: 'bytes', }, ], - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'constructor', @@ -1257,23 +1045,11 @@ export class OrderValidatorContract extends BaseContract { ] as ContractAbi; return abi; } - constructor( - address: string, - supportedProvider: SupportedProvider, - txDefaults?: Partial, - logDecodeDependencies?: { [contractName: string]: ContractAbi }, - ) { - super( - 'OrderValidator', - OrderValidatorContract.ABI(), - address, - supportedProvider, - txDefaults, - logDecodeDependencies, - ); + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + super('OrderValidator', OrderValidatorContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts b/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts index fdf60d3ea7..337f5b2078 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts @@ -1,14 +1,11 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { - BaseContract, +import { BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager, - PromiseWithTransactionHash, -} from '@0x/base-contract'; + SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -66,12 +63,17 @@ export interface WETH9WithdrawalEventArgs extends DecodedLogArgs { _value: BigNumber; } + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class WETH9Contract extends BaseContract { public name = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -80,7 +82,7 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as WETH9Contract; + const self = this as any as WETH9Contract; const encodedData = self._strictEncodeArguments('name()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -90,45 +92,55 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('name()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as WETH9Contract; + getABIEncodedTransactionData( + ): string { + const self = this as any as WETH9Contract; const abiEncodedTransactionData = self._strictEncodeArguments('name()', []); return abiEncodedTransactionData; }, }; public approve = { - async sendTransactionAsync(guy: string, wad: BigNumber, txData?: Partial | undefined): Promise { - assert.isString('guy', guy); - assert.isBigNumber('wad', wad); - const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy.toLowerCase(), wad]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind(self, guy.toLowerCase(), wad), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + guy: string, + wad: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isString('guy', guy); + assert.isBigNumber('wad', wad); + const self = this as any as WETH9Contract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy.toLowerCase(), + wad + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.approve.estimateGasAsync.bind( + self, + guy.toLowerCase(), + wad + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( guy: string, @@ -137,48 +149,57 @@ export class WETH9Contract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('guy', guy); - assert.isBigNumber('wad', wad); - const self = (this as any) as WETH9Contract; - const txHashPromise = self.approve.sendTransactionAsync(guy.toLowerCase(), wad, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('guy', guy); + assert.isBigNumber('wad', wad); + const self = this as any as WETH9Contract; + const txHashPromise = self.approve.sendTransactionAsync(guy.toLowerCase(), + wad + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(guy: string, wad: BigNumber, txData?: Partial | undefined): Promise { - assert.isString('guy', guy); - assert.isBigNumber('wad', wad); - const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy.toLowerCase(), wad]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + guy: string, + wad: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isString('guy', guy); + assert.isBigNumber('wad', wad); + const self = this as any as WETH9Contract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy.toLowerCase(), + wad + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( guy: string, wad: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('guy', guy); assert.isBigNumber('wad', wad); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -189,8 +210,10 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy.toLowerCase(), wad]); + const self = this as any as WETH9Contract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy.toLowerCase(), + wad + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -199,31 +222,36 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(guy: string, wad: BigNumber): string { + getABIEncodedTransactionData( + guy: string, + wad: BigNumber, + ): string { assert.isString('guy', guy); assert.isBigNumber('wad', wad); - const self = (this as any) as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [ - guy.toLowerCase(), - wad, - ]); + const self = this as any as WETH9Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [guy.toLowerCase(), + wad + ]); return abiEncodedTransactionData; }, }; public totalSupply = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -232,7 +260,7 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as WETH9Contract; + const self = this as any as WETH9Contract; const encodedData = self._strictEncodeArguments('totalSupply()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -242,20 +270,20 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('totalSupply()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as WETH9Contract; + getABIEncodedTransactionData( + ): string { + const self = this as any as WETH9Contract; const abiEncodedTransactionData = self._strictEncodeArguments('totalSupply()', []); return abiEncodedTransactionData; }, @@ -265,32 +293,36 @@ export class WETH9Contract extends BaseContract { src: string, dst: string, wad: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('src', src); - assert.isString('dst', dst); - assert.isBigNumber('wad', wad); - const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + assert.isString('src', src); + assert.isString('dst', dst); + assert.isBigNumber('wad', wad); + const self = this as any as WETH9Contract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [src.toLowerCase(), + dst.toLowerCase(), + wad + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferFrom.estimateGasAsync.bind( + self, src.toLowerCase(), dst.toLowerCase(), - wad, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind(self, src.toLowerCase(), dst.toLowerCase(), wad), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + wad + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( src: string, @@ -300,27 +332,25 @@ export class WETH9Contract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('src', src); - assert.isString('dst', dst); - assert.isBigNumber('wad', wad); - const self = (this as any) as WETH9Contract; - const txHashPromise = self.transferFrom.sendTransactionAsync( - src.toLowerCase(), - dst.toLowerCase(), - wad, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('src', src); + assert.isString('dst', dst); + assert.isBigNumber('wad', wad); + const self = this as any as WETH9Contract; + const txHashPromise = self.transferFrom.sendTransactionAsync(src.toLowerCase(), + dst.toLowerCase(), + wad + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( src: string, @@ -328,29 +358,28 @@ export class WETH9Contract extends BaseContract { wad: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('src', src); - assert.isString('dst', dst); - assert.isBigNumber('wad', wad); - const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - src.toLowerCase(), - dst.toLowerCase(), - wad, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('src', src); + assert.isString('dst', dst); + assert.isBigNumber('wad', wad); + const self = this as any as WETH9Contract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [src.toLowerCase(), + dst.toLowerCase(), + wad + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( src: string, @@ -358,7 +387,8 @@ export class WETH9Contract extends BaseContract { wad: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('src', src); assert.isString('dst', dst); assert.isBigNumber('wad', wad); @@ -370,12 +400,11 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - src.toLowerCase(), - dst.toLowerCase(), - wad, - ]); + const self = this as any as WETH9Contract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [src.toLowerCase(), + dst.toLowerCase(), + wad + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -384,51 +413,60 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(src: string, dst: string, wad: BigNumber): string { + getABIEncodedTransactionData( + src: string, + dst: string, + wad: BigNumber, + ): string { assert.isString('src', src); assert.isString('dst', dst); assert.isBigNumber('wad', wad); - const self = (this as any) as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - src.toLowerCase(), - dst.toLowerCase(), - wad, - ]); + const self = this as any as WETH9Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [src.toLowerCase(), + dst.toLowerCase(), + wad + ]); return abiEncodedTransactionData; }, }; public withdraw = { - async sendTransactionAsync(wad: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('wad', wad); - const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.withdraw.estimateGasAsync.bind(self, wad), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + wad: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('wad', wad); + const self = this as any as WETH9Contract; + const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.withdraw.estimateGasAsync.bind( + self, + wad + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( wad: BigNumber, @@ -436,41 +474,51 @@ export class WETH9Contract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('wad', wad); - const self = (this as any) as WETH9Contract; - const txHashPromise = self.withdraw.sendTransactionAsync(wad, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('wad', wad); + const self = this as any as WETH9Contract; + const txHashPromise = self.withdraw.sendTransactionAsync(wad + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(wad: BigNumber, txData?: Partial | undefined): Promise { - assert.isBigNumber('wad', wad); - const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + wad: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isBigNumber('wad', wad); + const self = this as any as WETH9Contract; + const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(wad: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + wad: BigNumber, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.isBigNumber('wad', wad); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -480,8 +528,9 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad]); + const self = this as any as WETH9Contract; + const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -490,27 +539,33 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('withdraw(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(wad: BigNumber): string { + getABIEncodedTransactionData( + wad: BigNumber, + ): string { assert.isBigNumber('wad', wad); - const self = (this as any) as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('withdraw(uint256)', [wad]); + const self = this as any as WETH9Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('withdraw(uint256)', [wad + ]); return abiEncodedTransactionData; }, }; public decimals = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -519,7 +574,7 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as WETH9Contract; + const self = this as any as WETH9Contract; const encodedData = self._strictEncodeArguments('decimals()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -529,20 +584,20 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('decimals()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as WETH9Contract; + getABIEncodedTransactionData( + ): string { + const self = this as any as WETH9Contract; const abiEncodedTransactionData = self._strictEncodeArguments('decimals()', []); return abiEncodedTransactionData; }, @@ -552,7 +607,8 @@ export class WETH9Contract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -562,8 +618,9 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [index_0.toLowerCase()]); + const self = this as any as WETH9Contract; + const encodedData = self._strictEncodeArguments('balanceOf(address)', [index_0.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -572,29 +629,33 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: string): string { + getABIEncodedTransactionData( + index_0: string, + ): string { assert.isString('index_0', index_0); - const self = (this as any) as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [ - index_0.toLowerCase(), - ]); + const self = this as any as WETH9Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [index_0.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public symbol = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -603,7 +664,7 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as WETH9Contract; + const self = this as any as WETH9Contract; const encodedData = self._strictEncodeArguments('symbol()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -613,45 +674,55 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('symbol()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as WETH9Contract; + getABIEncodedTransactionData( + ): string { + const self = this as any as WETH9Contract; const abiEncodedTransactionData = self._strictEncodeArguments('symbol()', []); return abiEncodedTransactionData; }, }; public transfer = { - async sendTransactionAsync(dst: string, wad: BigNumber, txData?: Partial | undefined): Promise { - assert.isString('dst', dst); - assert.isBigNumber('wad', wad); - const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst.toLowerCase(), wad]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transfer.estimateGasAsync.bind(self, dst.toLowerCase(), wad), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + dst: string, + wad: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isString('dst', dst); + assert.isBigNumber('wad', wad); + const self = this as any as WETH9Contract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst.toLowerCase(), + wad + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transfer.estimateGasAsync.bind( + self, + dst.toLowerCase(), + wad + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( dst: string, @@ -660,48 +731,57 @@ export class WETH9Contract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('dst', dst); - assert.isBigNumber('wad', wad); - const self = (this as any) as WETH9Contract; - const txHashPromise = self.transfer.sendTransactionAsync(dst.toLowerCase(), wad, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('dst', dst); + assert.isBigNumber('wad', wad); + const self = this as any as WETH9Contract; + const txHashPromise = self.transfer.sendTransactionAsync(dst.toLowerCase(), + wad + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(dst: string, wad: BigNumber, txData?: Partial | undefined): Promise { - assert.isString('dst', dst); - assert.isBigNumber('wad', wad); - const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst.toLowerCase(), wad]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + dst: string, + wad: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isString('dst', dst); + assert.isBigNumber('wad', wad); + const self = this as any as WETH9Contract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst.toLowerCase(), + wad + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( dst: string, wad: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('dst', dst); assert.isBigNumber('wad', wad); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -712,8 +792,10 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst.toLowerCase(), wad]); + const self = this as any as WETH9Contract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst.toLowerCase(), + wad + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -722,87 +804,98 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(dst: string, wad: BigNumber): string { + getABIEncodedTransactionData( + dst: string, + wad: BigNumber, + ): string { assert.isString('dst', dst); assert.isBigNumber('wad', wad); - const self = (this as any) as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [ - dst.toLowerCase(), - wad, - ]); + const self = this as any as WETH9Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [dst.toLowerCase(), + wad + ]); return abiEncodedTransactionData; }, }; public deposit = { - async sendTransactionAsync(txData?: Partial | undefined): Promise { - const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('deposit()', []); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.deposit.estimateGasAsync.bind(self), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync( + txData?: Partial | undefined, + ): Promise { + const self = this as any as WETH9Contract; + const encodedData = self._strictEncodeArguments('deposit()', []); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.deposit.estimateGasAsync.bind( + self, + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - const self = (this as any) as WETH9Contract; - const txHashPromise = self.deposit.sendTransactionAsync(txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + const self = this as any as WETH9Contract; + const txHashPromise = self.deposit.sendTransactionAsync(txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(txData?: Partial | undefined): Promise { - const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('deposit()', []); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + txData?: Partial | undefined, + ): Promise { + const self = this as any as WETH9Contract; + const encodedData = self._strictEncodeArguments('deposit()', []); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -811,7 +904,7 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as WETH9Contract; + const self = this as any as WETH9Contract; const encodedData = self._strictEncodeArguments('deposit()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -821,20 +914,20 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('deposit()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as WETH9Contract; + getABIEncodedTransactionData( + ): string { + const self = this as any as WETH9Contract; const abiEncodedTransactionData = self._strictEncodeArguments('deposit()', []); return abiEncodedTransactionData; }, @@ -845,7 +938,8 @@ export class WETH9Contract extends BaseContract { index_1: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.isString('index_1', index_1); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -856,11 +950,10 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as WETH9Contract; - const encodedData = self._strictEncodeArguments('allowance(address,address)', [ - index_0.toLowerCase(), - index_1.toLowerCase(), - ]); + const self = this as any as WETH9Contract; + const encodedData = self._strictEncodeArguments('allowance(address,address)', [index_0.toLowerCase(), + index_1.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -869,35 +962,36 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(index_0: string, index_1: string): string { + getABIEncodedTransactionData( + index_0: string, + index_1: string, + ): string { assert.isString('index_0', index_0); assert.isString('index_1', index_1); - const self = (this as any) as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [ - index_0.toLowerCase(), - index_1.toLowerCase(), - ]); + const self = this as any as WETH9Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [index_0.toLowerCase(), + index_1.toLowerCase() + ]); return abiEncodedTransactionData; }, }; - private readonly _subscriptionManager: SubscriptionManager; - public static async deployFrom0xArtifactAsync( +private readonly _subscriptionManager: SubscriptionManager; +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -910,11 +1004,8 @@ export class WETH9Contract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); - return WETH9Contract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); + return WETH9Contract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, ); } public static async deployAsync( bytecode: string, @@ -931,13 +1022,17 @@ export class WETH9Contract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); + [] = BaseContract._formatABIDataItemList( + constructorAbi.inputs, + [], + BaseContract._bigNumberToString, + ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -945,24 +1040,21 @@ export class WETH9Contract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`WETH9 successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new WETH9Contract( - txReceipt.contractAddress as string, - provider, - txDefaults, - logDecodeDependencies, - ); + const contractInstance = new WETH9Contract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); contractInstance.constructorArgs = []; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'name', outputs: [ { @@ -974,7 +1066,7 @@ export class WETH9Contract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -997,9 +1089,10 @@ export class WETH9Contract extends BaseContract { stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'totalSupply', outputs: [ { @@ -1011,7 +1104,7 @@ export class WETH9Contract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1038,7 +1131,7 @@ export class WETH9Contract extends BaseContract { stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1047,14 +1140,16 @@ export class WETH9Contract extends BaseContract { }, ], name: 'withdraw', - outputs: [], + outputs: [ + ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'decimals', outputs: [ { @@ -1066,7 +1161,7 @@ export class WETH9Contract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1085,9 +1180,10 @@ export class WETH9Contract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'symbol', outputs: [ { @@ -1099,7 +1195,7 @@ export class WETH9Contract extends BaseContract { stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1122,16 +1218,18 @@ export class WETH9Contract extends BaseContract { stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, - inputs: [], + inputs: [ + ], name: 'deposit', - outputs: [], + outputs: [ + ], payable: true, stateMutability: 'payable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1154,14 +1252,16 @@ export class WETH9Contract extends BaseContract { stateMutability: 'view', type: 'function', }, - { - inputs: [], - outputs: [], + { + inputs: [ + ], + outputs: [ + ], payable: true, stateMutability: 'payable', type: 'fallback', }, - { + { anonymous: false, inputs: [ { @@ -1181,10 +1281,11 @@ export class WETH9Contract extends BaseContract { }, ], name: 'Approval', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1204,10 +1305,11 @@ export class WETH9Contract extends BaseContract { }, ], name: 'Transfer', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1222,10 +1324,11 @@ export class WETH9Contract extends BaseContract { }, ], name: 'Deposit', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1240,7 +1343,8 @@ export class WETH9Contract extends BaseContract { }, ], name: 'Withdrawal', - outputs: [], + outputs: [ + ], type: 'event', }, ] as ContractAbi; @@ -1314,12 +1418,7 @@ export class WETH9Contract extends BaseContract { ); return logs; } - constructor( - address: string, - supportedProvider: SupportedProvider, - txDefaults?: Partial, - logDecodeDependencies?: { [contractName: string]: ContractAbi }, - ) { + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { super('WETH9', WETH9Contract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( @@ -1327,7 +1426,7 @@ export class WETH9Contract extends BaseContract { this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 d980c02253..04b7f16718 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts @@ -1,14 +1,11 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { - BaseContract, +import { BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager, - PromiseWithTransactionHash, -} from '@0x/base-contract'; + SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -31,7 +28,9 @@ import { assert } from '@0x/assert'; import * as ethers from 'ethers'; // tslint:enable:no-unused-variable -export type ZRXTokenEventArgs = ZRXTokenTransferEventArgs | ZRXTokenApprovalEventArgs; +export type ZRXTokenEventArgs = + | ZRXTokenTransferEventArgs + | ZRXTokenApprovalEventArgs; export enum ZRXTokenEvents { Transfer = 'Transfer', @@ -50,12 +49,17 @@ export interface ZRXTokenApprovalEventArgs extends DecodedLogArgs { _value: BigNumber; } + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class ZRXTokenContract extends BaseContract { public name = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -64,7 +68,7 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ZRXTokenContract; + const self = this as any as ZRXTokenContract; const encodedData = self._strictEncodeArguments('name()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -74,20 +78,20 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('name()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as ZRXTokenContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as ZRXTokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('name()', []); return abiEncodedTransactionData; }, @@ -96,30 +100,33 @@ export class ZRXTokenContract extends BaseContract { async sendTransactionAsync( _spender: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = (this as any) as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = this as any as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.approve.estimateGasAsync.bind( + self, _spender.toLowerCase(), - _value, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind(self, _spender.toLowerCase(), _value), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _value + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _spender: string, @@ -128,55 +135,57 @@ export class ZRXTokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = (this as any) as ZRXTokenContract; - const txHashPromise = self.approve.sendTransactionAsync(_spender.toLowerCase(), _value, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = this as any as ZRXTokenContract; + const txHashPromise = self.approve.sendTransactionAsync(_spender.toLowerCase(), + _value + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _spender: string, _value: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = (this as any) as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ - _spender.toLowerCase(), - _value, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = this as any as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _spender: string, _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -187,11 +196,10 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ - _spender.toLowerCase(), - _value, - ]); + const self = this as any as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), + _value + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -200,31 +208,36 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_spender: string, _value: BigNumber): string { + getABIEncodedTransactionData( + _spender: string, + _value: BigNumber, + ): string { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); - const self = (this as any) as ZRXTokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [ - _spender.toLowerCase(), - _value, - ]); + const self = this as any as ZRXTokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), + _value + ]); return abiEncodedTransactionData; }, }; public totalSupply = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -233,7 +246,7 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ZRXTokenContract; + const self = this as any as ZRXTokenContract; const encodedData = self._strictEncodeArguments('totalSupply()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -243,20 +256,20 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('totalSupply()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as ZRXTokenContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as ZRXTokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('totalSupply()', []); return abiEncodedTransactionData; }, @@ -266,32 +279,36 @@ export class ZRXTokenContract extends BaseContract { _from: string, _to: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferFrom.estimateGasAsync.bind( + self, _from.toLowerCase(), _to.toLowerCase(), - _value, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _value), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _value + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -301,27 +318,25 @@ export class ZRXTokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as ZRXTokenContract; - const txHashPromise = self.transferFrom.sendTransactionAsync( - _from.toLowerCase(), - _to.toLowerCase(), - _value, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as ZRXTokenContract; + const txHashPromise = self.transferFrom.sendTransactionAsync(_from.toLowerCase(), + _to.toLowerCase(), + _value + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -329,29 +344,28 @@ export class ZRXTokenContract extends BaseContract { _value: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _value, - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -359,7 +373,8 @@ export class ZRXTokenContract extends BaseContract { _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_value', _value); @@ -371,12 +386,11 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _value, - ]); + const self = this as any as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _value + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -385,33 +399,39 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_from: string, _to: string, _value: BigNumber): string { + getABIEncodedTransactionData( + _from: string, + _to: string, + _value: BigNumber, + ): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_value', _value); - const self = (this as any) as ZRXTokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ - _from.toLowerCase(), - _to.toLowerCase(), - _value, - ]); + const self = this as any as ZRXTokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), + _to.toLowerCase(), + _value + ]); return abiEncodedTransactionData; }, }; public decimals = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -420,7 +440,7 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ZRXTokenContract; + const self = this as any as ZRXTokenContract; const encodedData = self._strictEncodeArguments('decimals()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -430,20 +450,20 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('decimals()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as ZRXTokenContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as ZRXTokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('decimals()', []); return abiEncodedTransactionData; }, @@ -453,7 +473,8 @@ export class ZRXTokenContract extends BaseContract { _owner: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -463,8 +484,9 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); + const self = this as any as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -473,27 +495,33 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_owner: string): string { + getABIEncodedTransactionData( + _owner: string, + ): string { assert.isString('_owner', _owner); - const self = (this as any) as ZRXTokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); + const self = this as any as ZRXTokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() + ]); return abiEncodedTransactionData; }, }; public symbol = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -502,7 +530,7 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ZRXTokenContract; + const self = this as any as ZRXTokenContract; const encodedData = self._strictEncodeArguments('symbol()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -512,20 +540,20 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('symbol()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(): string { - const self = (this as any) as ZRXTokenContract; + getABIEncodedTransactionData( + ): string { + const self = this as any as ZRXTokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('symbol()', []); return abiEncodedTransactionData; }, @@ -534,27 +562,33 @@ export class ZRXTokenContract extends BaseContract { async sendTransactionAsync( _to: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transfer.estimateGasAsync.bind(self, _to.toLowerCase(), _value), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transfer.estimateGasAsync.bind( + self, + _to.toLowerCase(), + _value + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _to: string, @@ -563,48 +597,57 @@ export class ZRXTokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as ZRXTokenContract; - const txHashPromise = self.transfer.sendTransactionAsync(_to.toLowerCase(), _value, txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as ZRXTokenContract; + const txHashPromise = self.transfer.sendTransactionAsync(_to.toLowerCase(), + _value + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync(_to: string, _value: BigNumber, txData?: Partial | undefined): Promise { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = (this as any) as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync( + _to: string, + _value: BigNumber, + txData?: Partial | undefined, + ): Promise { + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), + _value + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _to: string, _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_to', _to); assert.isBigNumber('_value', _value); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -615,8 +658,10 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); + const self = this as any as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), + _value + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -625,26 +670,27 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_to: string, _value: BigNumber): string { + getABIEncodedTransactionData( + _to: string, + _value: BigNumber, + ): string { assert.isString('_to', _to); assert.isBigNumber('_value', _value); - const self = (this as any) as ZRXTokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [ - _to.toLowerCase(), - _value, - ]); + const self = this as any as ZRXTokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), + _value + ]); return abiEncodedTransactionData; }, }; @@ -654,7 +700,8 @@ export class ZRXTokenContract extends BaseContract { _spender: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.isString('_spender', _spender); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -665,11 +712,10 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('allowance(address,address)', [ - _owner.toLowerCase(), - _spender.toLowerCase(), - ]); + const self = this as any as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('allowance(address,address)', [_owner.toLowerCase(), + _spender.toLowerCase() + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -678,35 +724,36 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData(_owner: string, _spender: string): string { + getABIEncodedTransactionData( + _owner: string, + _spender: string, + ): string { assert.isString('_owner', _owner); assert.isString('_spender', _spender); - const self = (this as any) as ZRXTokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [ - _owner.toLowerCase(), - _spender.toLowerCase(), - ]); + const self = this as any as ZRXTokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [_owner.toLowerCase(), + _spender.toLowerCase() + ]); return abiEncodedTransactionData; }, }; - private readonly _subscriptionManager: SubscriptionManager; - public static async deployFrom0xArtifactAsync( +private readonly _subscriptionManager: SubscriptionManager; +public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -719,11 +766,8 @@ export class ZRXTokenContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); - return ZRXTokenContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); + return ZRXTokenContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, ); } public static async deployAsync( bytecode: string, @@ -740,13 +784,17 @@ export class ZRXTokenContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); + [] = BaseContract._formatABIDataItemList( + constructorAbi.inputs, + [], + BaseContract._bigNumberToString, + ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -754,24 +802,21 @@ export class ZRXTokenContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`ZRXToken successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ZRXTokenContract( - txReceipt.contractAddress as string, - provider, - txDefaults, - logDecodeDependencies, - ); + const contractInstance = new ZRXTokenContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); contractInstance.constructorArgs = []; return contractInstance; } + /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'name', outputs: [ { @@ -782,7 +827,7 @@ export class ZRXTokenContract extends BaseContract { payable: false, type: 'function', }, - { + { constant: false, inputs: [ { @@ -804,9 +849,10 @@ export class ZRXTokenContract extends BaseContract { payable: false, type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'totalSupply', outputs: [ { @@ -817,7 +863,7 @@ export class ZRXTokenContract extends BaseContract { payable: false, type: 'function', }, - { + { constant: false, inputs: [ { @@ -843,9 +889,10 @@ export class ZRXTokenContract extends BaseContract { payable: false, type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'decimals', outputs: [ { @@ -856,7 +903,7 @@ export class ZRXTokenContract extends BaseContract { payable: false, type: 'function', }, - { + { constant: true, inputs: [ { @@ -874,9 +921,10 @@ export class ZRXTokenContract extends BaseContract { payable: false, type: 'function', }, - { + { constant: true, - inputs: [], + inputs: [ + ], name: 'symbol', outputs: [ { @@ -887,7 +935,7 @@ export class ZRXTokenContract extends BaseContract { payable: false, type: 'function', }, - { + { constant: false, inputs: [ { @@ -909,7 +957,7 @@ export class ZRXTokenContract extends BaseContract { payable: false, type: 'function', }, - { + { constant: true, inputs: [ { @@ -931,13 +979,15 @@ export class ZRXTokenContract extends BaseContract { payable: false, type: 'function', }, - { - inputs: [], - outputs: [], + { + inputs: [ + ], + outputs: [ + ], payable: false, type: 'constructor', }, - { + { anonymous: false, inputs: [ { @@ -957,10 +1007,11 @@ export class ZRXTokenContract extends BaseContract { }, ], name: 'Transfer', - outputs: [], + outputs: [ + ], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -980,7 +1031,8 @@ export class ZRXTokenContract extends BaseContract { }, ], name: 'Approval', - outputs: [], + outputs: [ + ], type: 'event', }, ] as ContractAbi; @@ -1054,12 +1106,7 @@ export class ZRXTokenContract extends BaseContract { ); return logs; } - constructor( - address: string, - supportedProvider: SupportedProvider, - txDefaults?: Partial, - logDecodeDependencies?: { [contractName: string]: ContractAbi }, - ) { + constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { super('ZRXToken', ZRXTokenContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( @@ -1067,7 +1114,7 @@ export class ZRXTokenContract extends BaseContract { this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align From a8939d3edaa4556fc887aa91347cb8b356b20ab8 Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Mon, 29 Jul 2019 12:28:28 +0200 Subject: [PATCH 12/15] Updated expected typescript output for abi-gen cli tests --- .../expected-output/typescript/abi_gen_dummy.ts | 17 +++++++---------- .../expected-output/typescript/lib_dummy.ts | 17 +++++++---------- .../typescript/test_lib_dummy.ts | 17 +++++++---------- 3 files changed, 21 insertions(+), 30 deletions(-) diff --git a/packages/abi-gen/test-cli/expected-output/typescript/abi_gen_dummy.ts b/packages/abi-gen/test-cli/expected-output/typescript/abi_gen_dummy.ts index 0f7348cb9f..0c7af7906f 100644 --- a/packages/abi-gen/test-cli/expected-output/typescript/abi_gen_dummy.ts +++ b/packages/abi-gen/test-cli/expected-output/typescript/abi_gen_dummy.ts @@ -29,7 +29,6 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; -import * as _ from 'lodash'; // tslint:enable:no-unused-variable export type AbiGenDummyEventArgs = AbiGenDummyWithdrawalEventArgs | AbiGenDummyAnEventEventArgs; @@ -1023,7 +1022,7 @@ export class AbiGenDummyContract extends BaseContract { artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -1036,20 +1035,18 @@ export class AbiGenDummyContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues( - artifactDependencies, - (artifactDependency: ContractArtifact | SimpleContractArtifact) => { - return artifactDependency.compilerOutput.abi; - }, + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, ); - return AbiGenDummyContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies); + return AbiGenDummyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, - abiDependencies: { [contractName: string]: ContractAbi }, + logDecodeDependencies: { [contractName: string]: ContractAbi }, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -1077,7 +1074,7 @@ export class AbiGenDummyContract extends BaseContract { txReceipt.contractAddress as string, provider, txDefaults, - abiDependencies, + logDecodeDependencies, ); contractInstance.constructorArgs = []; return contractInstance; diff --git a/packages/abi-gen/test-cli/expected-output/typescript/lib_dummy.ts b/packages/abi-gen/test-cli/expected-output/typescript/lib_dummy.ts index 7f41b6deae..38469721ec 100644 --- a/packages/abi-gen/test-cli/expected-output/typescript/lib_dummy.ts +++ b/packages/abi-gen/test-cli/expected-output/typescript/lib_dummy.ts @@ -21,7 +21,6 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; -import * as _ from 'lodash'; // tslint:enable:no-unused-variable /* istanbul ignore next */ @@ -32,7 +31,7 @@ export class LibDummyContract extends BaseContract { artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -45,20 +44,18 @@ export class LibDummyContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues( - artifactDependencies, - (artifactDependency: ContractArtifact | SimpleContractArtifact) => { - return artifactDependency.compilerOutput.abi; - }, + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, ); - return LibDummyContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies); + return LibDummyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, - abiDependencies: { [contractName: string]: ContractAbi }, + logDecodeDependencies: { [contractName: string]: ContractAbi }, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -86,7 +83,7 @@ export class LibDummyContract extends BaseContract { txReceipt.contractAddress as string, provider, txDefaults, - abiDependencies, + logDecodeDependencies, ); contractInstance.constructorArgs = []; return contractInstance; diff --git a/packages/abi-gen/test-cli/expected-output/typescript/test_lib_dummy.ts b/packages/abi-gen/test-cli/expected-output/typescript/test_lib_dummy.ts index 364c78f740..d5d5437643 100644 --- a/packages/abi-gen/test-cli/expected-output/typescript/test_lib_dummy.ts +++ b/packages/abi-gen/test-cli/expected-output/typescript/test_lib_dummy.ts @@ -21,7 +21,6 @@ import { SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; -import * as _ from 'lodash'; // tslint:enable:no-unused-variable /* istanbul ignore next */ @@ -112,7 +111,7 @@ export class TestLibDummyContract extends BaseContract { artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - artifactDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -125,20 +124,18 @@ export class TestLibDummyContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const abiDependencies = _.mapValues( - artifactDependencies, - (artifactDependency: ContractArtifact | SimpleContractArtifact) => { - return artifactDependency.compilerOutput.abi; - }, + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, ); - return TestLibDummyContract.deployAsync(bytecode, abi, provider, txDefaults, abiDependencies); + return TestLibDummyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, - abiDependencies: { [contractName: string]: ContractAbi }, + logDecodeDependencies: { [contractName: string]: ContractAbi }, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -166,7 +163,7 @@ export class TestLibDummyContract extends BaseContract { txReceipt.contractAddress as string, provider, txDefaults, - abiDependencies, + logDecodeDependencies, ); contractInstance.constructorArgs = []; return contractInstance; From 26ee4d626c6c7c97958f7a9144750d90ca03b740 Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Mon, 29 Jul 2019 15:57:59 +0200 Subject: [PATCH 13/15] ran prettier on abi-gen-wrappers --- .../generated-wrappers/asset_proxy_owner.ts | 2353 ++++---- .../src/generated-wrappers/coordinator.ts | 628 +- .../coordinator_registry.ts | 256 +- .../generated-wrappers/dummy_erc20_token.ts | 1299 ++-- .../generated-wrappers/dummy_erc721_token.ts | 1646 +++--- .../src/generated-wrappers/dutch_auction.ts | 691 ++- .../src/generated-wrappers/erc20_proxy.ts | 820 ++- .../src/generated-wrappers/erc20_token.ts | 642 +- .../src/generated-wrappers/erc721_proxy.ts | 820 ++- .../src/generated-wrappers/erc721_token.ts | 1066 ++-- .../generated-wrappers/eth_balance_checker.ts | 76 +- .../src/generated-wrappers/exchange.ts | 5200 ++++++++++------- .../src/generated-wrappers/forwarder.ts | 1305 +++-- .../src/generated-wrappers/i_asset_proxy.ts | 904 ++- .../src/generated-wrappers/i_validator.ts | 81 +- .../src/generated-wrappers/i_wallet.ts | 73 +- .../generated-wrappers/multi_asset_proxy.ts | 1041 ++-- .../src/generated-wrappers/order_validator.ts | 586 +- .../src/generated-wrappers/weth9.ts | 1027 ++-- .../src/generated-wrappers/zrx_token.ts | 731 ++- 20 files changed, 11073 insertions(+), 10172 deletions(-) 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 db528702d2..d4f38be5c3 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 @@ -1,11 +1,14 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, +import { + BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; + SubscriptionManager, + PromiseWithTransactionHash, +} from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -110,7 +113,6 @@ export interface AssetProxyOwnerRequirementChangeEventArgs extends DecodedLogArg required: BigNumber; } - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name @@ -120,8 +122,7 @@ export class AssetProxyOwnerContract extends BaseContract { index_0: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -131,9 +132,8 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('owners(uint256)', [index_0 - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('owners(uint256)', [index_0]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -142,54 +142,45 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owners(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: BigNumber, - ): string { + getABIEncodedTransactionData(index_0: BigNumber): string { assert.isBigNumber('index_0', index_0); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('owners(uint256)', [index_0 - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('owners(uint256)', [index_0]); return abiEncodedTransactionData; }, }; public removeOwner = { - async sendTransactionAsync( - owner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('owner', owner); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeOwner.estimateGasAsync.bind( - self, - owner.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(owner: string, txData?: Partial | undefined): Promise { + assert.isString('owner', owner); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeOwner.estimateGasAsync.bind(self, owner.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( owner: string, @@ -197,51 +188,41 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('owner', owner); - const self = this as any as AssetProxyOwnerContract; - const txHashPromise = self.removeOwner.sendTransactionAsync(owner.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('owner', owner); + const self = (this as any) as AssetProxyOwnerContract; + const txHashPromise = self.removeOwner.sendTransactionAsync(owner.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - owner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('owner', owner); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(owner: string, txData?: Partial | undefined): Promise { + assert.isString('owner', owner); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - owner: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(owner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('owner', owner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -251,9 +232,8 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner.toLowerCase() - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -262,54 +242,47 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeOwner(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - owner: string, - ): string { + getABIEncodedTransactionData(owner: string): string { assert.isString('owner', owner); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeOwner(address)', [owner.toLowerCase() - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeOwner(address)', [ + owner.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public revokeConfirmation = { - async sendTransactionAsync( - transactionId: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.revokeConfirmation.estimateGasAsync.bind( - self, - transactionId - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(transactionId: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('transactionId', transactionId); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.revokeConfirmation.estimateGasAsync.bind(self, transactionId), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( transactionId: BigNumber, @@ -317,51 +290,45 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const txHashPromise = self.revokeConfirmation.sendTransactionAsync(transactionId - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('transactionId', transactionId); + const self = (this as any) as AssetProxyOwnerContract; + const txHashPromise = self.revokeConfirmation.sendTransactionAsync(transactionId, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - transactionId: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(transactionId: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('transactionId', transactionId); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( transactionId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('transactionId', transactionId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -371,9 +338,8 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -382,24 +348,24 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('revokeConfirmation(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - transactionId: BigNumber, - ): string { + getABIEncodedTransactionData(transactionId: BigNumber): string { assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('revokeConfirmation(uint256)', [ + transactionId, + ]); return abiEncodedTransactionData; }, }; @@ -408,8 +374,7 @@ export class AssetProxyOwnerContract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -419,9 +384,8 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('isOwner(address)', [index_0.toLowerCase() - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('isOwner(address)', [index_0.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -430,24 +394,22 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isOwner(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: string, - ): string { + getABIEncodedTransactionData(index_0: string): string { assert.isString('index_0', index_0); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('isOwner(address)', [index_0.toLowerCase() - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isOwner(address)', [index_0.toLowerCase()]); return abiEncodedTransactionData; }, }; @@ -457,8 +419,7 @@ export class AssetProxyOwnerContract extends BaseContract { index_1: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('index_0', index_0); assert.isString('index_1', index_1); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -469,10 +430,11 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('confirmations(uint256,address)', [index_0, - index_1.toLowerCase() - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('confirmations(uint256,address)', [ + index_0, + index_1.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -481,57 +443,51 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('confirmations(uint256,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: BigNumber, - index_1: string, - ): string { + getABIEncodedTransactionData(index_0: BigNumber, index_1: string): string { assert.isBigNumber('index_0', index_0); assert.isString('index_1', index_1); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('confirmations(uint256,address)', [index_0, - index_1.toLowerCase() - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('confirmations(uint256,address)', [ + index_0, + index_1.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public executeRemoveAuthorizedAddressAtIndex = { - async sendTransactionAsync( - transactionId: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.executeRemoveAuthorizedAddressAtIndex.estimateGasAsync.bind( - self, - transactionId - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(transactionId: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('transactionId', transactionId); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [ + transactionId, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.executeRemoveAuthorizedAddressAtIndex.estimateGasAsync.bind(self, transactionId), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( transactionId: BigNumber, @@ -539,51 +495,50 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const txHashPromise = self.executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(transactionId - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('transactionId', transactionId); + const self = (this as any) as AssetProxyOwnerContract; + const txHashPromise = self.executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync( + transactionId, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - transactionId: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(transactionId: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('transactionId', transactionId); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [ + transactionId, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( transactionId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('transactionId', transactionId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -593,9 +548,10 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [transactionId - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [ + transactionId, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -604,33 +560,30 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('executeRemoveAuthorizedAddressAtIndex(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - transactionId: BigNumber, - ): string { + getABIEncodedTransactionData(transactionId: BigNumber): string { assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [transactionId - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'executeRemoveAuthorizedAddressAtIndex(uint256)', + [transactionId], + ); return abiEncodedTransactionData; }, }; public secondsTimeLocked = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -639,7 +592,7 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; + const self = (this as any) as AssetProxyOwnerContract; const encodedData = self._strictEncodeArguments('secondsTimeLocked()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -649,20 +602,20 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('secondsTimeLocked()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as AssetProxyOwnerContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as AssetProxyOwnerContract; const abiEncodedTransactionData = self._strictEncodeArguments('secondsTimeLocked()', []); return abiEncodedTransactionData; }, @@ -673,8 +626,7 @@ export class AssetProxyOwnerContract extends BaseContract { executed: boolean, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBoolean('pending', pending); assert.isBoolean('executed', executed); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -685,10 +637,8 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('getTransactionCount(bool,bool)', [pending, - executed - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('getTransactionCount(bool,bool)', [pending, executed]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -697,27 +647,26 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getTransactionCount(bool,bool)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - pending: boolean, - executed: boolean, - ): string { + getABIEncodedTransactionData(pending: boolean, executed: boolean): string { assert.isBoolean('pending', pending); assert.isBoolean('executed', executed); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getTransactionCount(bool,bool)', [pending, - executed - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getTransactionCount(bool,bool)', [ + pending, + executed, + ]); return abiEncodedTransactionData; }, }; @@ -725,33 +674,30 @@ export class AssetProxyOwnerContract extends BaseContract { async sendTransactionAsync( assetProxyContract: string, isRegistered: boolean, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('assetProxyContract', assetProxyContract); - assert.isBoolean('isRegistered', isRegistered); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [assetProxyContract.toLowerCase(), - isRegistered - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.registerAssetProxy.estimateGasAsync.bind( - self, + assert.isString('assetProxyContract', assetProxyContract); + assert.isBoolean('isRegistered', isRegistered); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [ assetProxyContract.toLowerCase(), - isRegistered - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + isRegistered, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.registerAssetProxy.estimateGasAsync.bind(self, assetProxyContract.toLowerCase(), isRegistered), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( assetProxyContract: string, @@ -760,57 +706,59 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('assetProxyContract', assetProxyContract); - assert.isBoolean('isRegistered', isRegistered); - const self = this as any as AssetProxyOwnerContract; - const txHashPromise = self.registerAssetProxy.sendTransactionAsync(assetProxyContract.toLowerCase(), - isRegistered - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('assetProxyContract', assetProxyContract); + assert.isBoolean('isRegistered', isRegistered); + const self = (this as any) as AssetProxyOwnerContract; + const txHashPromise = self.registerAssetProxy.sendTransactionAsync( + assetProxyContract.toLowerCase(), + isRegistered, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( assetProxyContract: string, isRegistered: boolean, txData?: Partial | undefined, ): Promise { - assert.isString('assetProxyContract', assetProxyContract); - assert.isBoolean('isRegistered', isRegistered); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [assetProxyContract.toLowerCase(), - isRegistered - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('assetProxyContract', assetProxyContract); + assert.isBoolean('isRegistered', isRegistered); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [ + assetProxyContract.toLowerCase(), + isRegistered, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( assetProxyContract: string, isRegistered: boolean, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('assetProxyContract', assetProxyContract); assert.isBoolean('isRegistered', isRegistered); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -821,10 +769,11 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [assetProxyContract.toLowerCase(), - isRegistered - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [ + assetProxyContract.toLowerCase(), + isRegistered, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -833,57 +782,49 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address,bool)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - assetProxyContract: string, - isRegistered: boolean, - ): string { + getABIEncodedTransactionData(assetProxyContract: string, isRegistered: boolean): string { assert.isString('assetProxyContract', assetProxyContract); assert.isBoolean('isRegistered', isRegistered); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [assetProxyContract.toLowerCase(), - isRegistered - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [ + assetProxyContract.toLowerCase(), + isRegistered, + ]); return abiEncodedTransactionData; }, }; public addOwner = { - async sendTransactionAsync( - owner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('owner', owner); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.addOwner.estimateGasAsync.bind( - self, - owner.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(owner: string, txData?: Partial | undefined): Promise { + assert.isString('owner', owner); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.addOwner.estimateGasAsync.bind(self, owner.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( owner: string, @@ -891,51 +832,41 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('owner', owner); - const self = this as any as AssetProxyOwnerContract; - const txHashPromise = self.addOwner.sendTransactionAsync(owner.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('owner', owner); + const self = (this as any) as AssetProxyOwnerContract; + const txHashPromise = self.addOwner.sendTransactionAsync(owner.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - owner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('owner', owner); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(owner: string, txData?: Partial | undefined): Promise { + assert.isString('owner', owner); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - owner: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(owner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('owner', owner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -945,9 +876,8 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase() - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -956,24 +886,22 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('addOwner(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - owner: string, - ): string { + getABIEncodedTransactionData(owner: string): string { assert.isString('owner', owner); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase() - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase()]); return abiEncodedTransactionData; }, }; @@ -982,8 +910,7 @@ export class AssetProxyOwnerContract extends BaseContract { transactionId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('transactionId', transactionId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -993,9 +920,8 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('isConfirmed(uint256)', [transactionId - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('isConfirmed(uint256)', [transactionId]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1004,54 +930,48 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isConfirmed(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - transactionId: BigNumber, - ): string { + getABIEncodedTransactionData(transactionId: BigNumber): string { assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('isConfirmed(uint256)', [transactionId - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isConfirmed(uint256)', [transactionId]); return abiEncodedTransactionData; }, }; public changeTimeLock = { async sendTransactionAsync( _secondsTimeLocked: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.changeTimeLock.estimateGasAsync.bind( - self, - _secondsTimeLocked - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.changeTimeLock.estimateGasAsync.bind(self, _secondsTimeLocked), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _secondsTimeLocked: BigNumber, @@ -1059,51 +979,45 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); - const self = this as any as AssetProxyOwnerContract; - const txHashPromise = self.changeTimeLock.sendTransactionAsync(_secondsTimeLocked - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); + const self = (this as any) as AssetProxyOwnerContract; + const txHashPromise = self.changeTimeLock.sendTransactionAsync(_secondsTimeLocked, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - _secondsTimeLocked: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(_secondsTimeLocked: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _secondsTimeLocked: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1113,9 +1027,8 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1124,24 +1037,24 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('changeTimeLock(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _secondsTimeLocked: BigNumber, - ): string { + getABIEncodedTransactionData(_secondsTimeLocked: BigNumber): string { assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('changeTimeLock(uint256)', [ + _secondsTimeLocked, + ]); return abiEncodedTransactionData; }, }; @@ -1150,8 +1063,7 @@ export class AssetProxyOwnerContract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1161,9 +1073,8 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('isAssetProxyRegistered(address)', [index_0.toLowerCase() - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('isAssetProxyRegistered(address)', [index_0.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1172,24 +1083,24 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isAssetProxyRegistered(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: string, - ): string { + getABIEncodedTransactionData(index_0: string): string { assert.isString('index_0', index_0); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('isAssetProxyRegistered(address)', [index_0.toLowerCase() - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isAssetProxyRegistered(address)', [ + index_0.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; @@ -1198,8 +1109,7 @@ export class AssetProxyOwnerContract extends BaseContract { transactionId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('transactionId', transactionId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1209,9 +1119,8 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('getConfirmationCount(uint256)', [transactionId - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('getConfirmationCount(uint256)', [transactionId]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1220,24 +1129,24 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getConfirmationCount(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - transactionId: BigNumber, - ): string { + getABIEncodedTransactionData(transactionId: BigNumber): string { assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getConfirmationCount(uint256)', [transactionId - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getConfirmationCount(uint256)', [ + transactionId, + ]); return abiEncodedTransactionData; }, }; @@ -1246,8 +1155,7 @@ export class AssetProxyOwnerContract extends BaseContract { index_0: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<[string, BigNumber, string, boolean] - > { + ): Promise<[string, BigNumber, string, boolean]> { assert.isBigNumber('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1257,9 +1165,8 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('transactions(uint256)', [index_0 - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('transactions(uint256)', [index_0]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1268,33 +1175,27 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transactions(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<[string, BigNumber, string, boolean] - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<[string, BigNumber, string, boolean]>(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: BigNumber, - ): string { + getABIEncodedTransactionData(index_0: BigNumber): string { assert.isBigNumber('index_0', index_0); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transactions(uint256)', [index_0 - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transactions(uint256)', [index_0]); return abiEncodedTransactionData; }, }; public getOwners = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -1303,7 +1204,7 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; + const self = (this as any) as AssetProxyOwnerContract; const encodedData = self._strictEncodeArguments('getOwners()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1313,20 +1214,20 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getOwners()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as AssetProxyOwnerContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as AssetProxyOwnerContract; const abiEncodedTransactionData = self._strictEncodeArguments('getOwners()', []); return abiEncodedTransactionData; }, @@ -1339,8 +1240,7 @@ export class AssetProxyOwnerContract extends BaseContract { executed: boolean, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('from', from); assert.isBigNumber('to', to); assert.isBoolean('pending', pending); @@ -1353,12 +1253,13 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('getTransactionIds(uint256,uint256,bool,bool)', [from, - to, - pending, - executed - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('getTransactionIds(uint256,uint256,bool,bool)', [ + from, + to, + pending, + executed, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1367,33 +1268,28 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getTransactionIds(uint256,uint256,bool,bool)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - from: BigNumber, - to: BigNumber, - pending: boolean, - executed: boolean, - ): string { + getABIEncodedTransactionData(from: BigNumber, to: BigNumber, pending: boolean, executed: boolean): string { assert.isBigNumber('from', from); assert.isBigNumber('to', to); assert.isBoolean('pending', pending); assert.isBoolean('executed', executed); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getTransactionIds(uint256,uint256,bool,bool)', [from, - to, - pending, - executed - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'getTransactionIds(uint256,uint256,bool,bool)', + [from, to, pending, executed], + ); return abiEncodedTransactionData; }, }; @@ -1402,8 +1298,7 @@ export class AssetProxyOwnerContract extends BaseContract { transactionId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('transactionId', transactionId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1413,9 +1308,8 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('getConfirmations(uint256)', [transactionId - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('getConfirmations(uint256)', [transactionId]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1424,33 +1318,27 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getConfirmations(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - transactionId: BigNumber, - ): string { + getABIEncodedTransactionData(transactionId: BigNumber): string { assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getConfirmations(uint256)', [transactionId - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getConfirmations(uint256)', [transactionId]); return abiEncodedTransactionData; }, }; public transactionCount = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -1459,7 +1347,7 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; + const self = (this as any) as AssetProxyOwnerContract; const encodedData = self._strictEncodeArguments('transactionCount()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1469,51 +1357,44 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transactionCount()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as AssetProxyOwnerContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as AssetProxyOwnerContract; const abiEncodedTransactionData = self._strictEncodeArguments('transactionCount()', []); return abiEncodedTransactionData; }, }; public changeRequirement = { - async sendTransactionAsync( - _required: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('_required', _required); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('changeRequirement(uint256)', [_required - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.changeRequirement.estimateGasAsync.bind( - self, - _required - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(_required: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('_required', _required); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('changeRequirement(uint256)', [_required]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.changeRequirement.estimateGasAsync.bind(self, _required), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _required: BigNumber, @@ -1521,51 +1402,45 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('_required', _required); - const self = this as any as AssetProxyOwnerContract; - const txHashPromise = self.changeRequirement.sendTransactionAsync(_required - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('_required', _required); + const self = (this as any) as AssetProxyOwnerContract; + const txHashPromise = self.changeRequirement.sendTransactionAsync(_required, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - _required: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('_required', _required); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('changeRequirement(uint256)', [_required - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(_required: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('_required', _required); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('changeRequirement(uint256)', [_required]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _required: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('_required', _required); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1575,9 +1450,8 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('changeRequirement(uint256)', [_required - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('changeRequirement(uint256)', [_required]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1586,54 +1460,45 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('changeRequirement(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _required: BigNumber, - ): string { + getABIEncodedTransactionData(_required: BigNumber): string { assert.isBigNumber('_required', _required); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('changeRequirement(uint256)', [_required - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('changeRequirement(uint256)', [_required]); return abiEncodedTransactionData; }, }; public confirmTransaction = { - async sendTransactionAsync( - transactionId: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.confirmTransaction.estimateGasAsync.bind( - self, - transactionId - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(transactionId: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('transactionId', transactionId); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.confirmTransaction.estimateGasAsync.bind(self, transactionId), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( transactionId: BigNumber, @@ -1641,51 +1506,45 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const txHashPromise = self.confirmTransaction.sendTransactionAsync(transactionId - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('transactionId', transactionId); + const self = (this as any) as AssetProxyOwnerContract; + const txHashPromise = self.confirmTransaction.sendTransactionAsync(transactionId, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - transactionId: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(transactionId: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('transactionId', transactionId); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( transactionId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('transactionId', transactionId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1695,9 +1554,8 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1706,24 +1564,24 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('confirmTransaction(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - transactionId: BigNumber, - ): string { + getABIEncodedTransactionData(transactionId: BigNumber): string { assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('confirmTransaction(uint256)', [ + transactionId, + ]); return abiEncodedTransactionData; }, }; @@ -1732,36 +1590,32 @@ export class AssetProxyOwnerContract extends BaseContract { destination: string, value: BigNumber, data: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('destination', destination); - assert.isBigNumber('value', value); - assert.isString('data', data); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [destination.toLowerCase(), - value, - data - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.submitTransaction.estimateGasAsync.bind( - self, + assert.isString('destination', destination); + assert.isBigNumber('value', value); + assert.isString('data', data); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [ destination.toLowerCase(), value, - data - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + data, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.submitTransaction.estimateGasAsync.bind(self, destination.toLowerCase(), value, data), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( destination: string, @@ -1771,25 +1625,27 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('destination', destination); - assert.isBigNumber('value', value); - assert.isString('data', data); - const self = this as any as AssetProxyOwnerContract; - const txHashPromise = self.submitTransaction.sendTransactionAsync(destination.toLowerCase(), - value, - data - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('destination', destination); + assert.isBigNumber('value', value); + assert.isString('data', data); + const self = (this as any) as AssetProxyOwnerContract; + const txHashPromise = self.submitTransaction.sendTransactionAsync( + destination.toLowerCase(), + value, + data, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( destination: string, @@ -1797,28 +1653,29 @@ export class AssetProxyOwnerContract extends BaseContract { data: string, txData?: Partial | undefined, ): Promise { - assert.isString('destination', destination); - assert.isBigNumber('value', value); - assert.isString('data', data); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [destination.toLowerCase(), - value, - data - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('destination', destination); + assert.isBigNumber('value', value); + assert.isString('data', data); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [ + destination.toLowerCase(), + value, + data, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( destination: string, @@ -1826,8 +1683,7 @@ export class AssetProxyOwnerContract extends BaseContract { data: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('destination', destination); assert.isBigNumber('value', value); assert.isString('data', data); @@ -1839,11 +1695,12 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [destination.toLowerCase(), - value, - data - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [ + destination.toLowerCase(), + value, + data, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1852,30 +1709,28 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('submitTransaction(address,uint256,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - destination: string, - value: BigNumber, - data: string, - ): string { + getABIEncodedTransactionData(destination: string, value: BigNumber, data: string): string { assert.isString('destination', destination); assert.isBigNumber('value', value); assert.isString('data', data); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [destination.toLowerCase(), - value, - data - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [ + destination.toLowerCase(), + value, + data, + ]); return abiEncodedTransactionData; }, }; @@ -1884,8 +1739,7 @@ export class AssetProxyOwnerContract extends BaseContract { index_0: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1895,9 +1749,8 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('confirmationTimes(uint256)', [index_0 - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('confirmationTimes(uint256)', [index_0]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1906,33 +1759,27 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('confirmationTimes(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: BigNumber, - ): string { + getABIEncodedTransactionData(index_0: BigNumber): string { assert.isBigNumber('index_0', index_0); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('confirmationTimes(uint256)', [index_0 - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('confirmationTimes(uint256)', [index_0]); return abiEncodedTransactionData; }, }; public MAX_OWNER_COUNT = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -1941,7 +1788,7 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; + const self = (this as any) as AssetProxyOwnerContract; const encodedData = self._strictEncodeArguments('MAX_OWNER_COUNT()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1951,30 +1798,26 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('MAX_OWNER_COUNT()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as AssetProxyOwnerContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as AssetProxyOwnerContract; const abiEncodedTransactionData = self._strictEncodeArguments('MAX_OWNER_COUNT()', []); return abiEncodedTransactionData; }, }; public required = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -1983,7 +1826,7 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; + const self = (this as any) as AssetProxyOwnerContract; const encodedData = self._strictEncodeArguments('required()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1993,20 +1836,20 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('required()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as AssetProxyOwnerContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as AssetProxyOwnerContract; const abiEncodedTransactionData = self._strictEncodeArguments('required()', []); return abiEncodedTransactionData; }, @@ -2015,33 +1858,30 @@ export class AssetProxyOwnerContract extends BaseContract { async sendTransactionAsync( owner: string, newOwner: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('owner', owner); - assert.isString('newOwner', newOwner); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [owner.toLowerCase(), - newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.replaceOwner.estimateGasAsync.bind( - self, + assert.isString('owner', owner); + assert.isString('newOwner', newOwner); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [ owner.toLowerCase(), - newOwner.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + newOwner.toLowerCase(), + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.replaceOwner.estimateGasAsync.bind(self, owner.toLowerCase(), newOwner.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( owner: string, @@ -2050,57 +1890,55 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('owner', owner); - assert.isString('newOwner', newOwner); - const self = this as any as AssetProxyOwnerContract; - const txHashPromise = self.replaceOwner.sendTransactionAsync(owner.toLowerCase(), - newOwner.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('owner', owner); + assert.isString('newOwner', newOwner); + const self = (this as any) as AssetProxyOwnerContract; + const txHashPromise = self.replaceOwner.sendTransactionAsync( + owner.toLowerCase(), + newOwner.toLowerCase(), + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - owner: string, - newOwner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('owner', owner); - assert.isString('newOwner', newOwner); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [owner.toLowerCase(), - newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(owner: string, newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('owner', owner); + assert.isString('newOwner', newOwner); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [ + owner.toLowerCase(), + newOwner.toLowerCase(), + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( owner: string, newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('owner', owner); assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -2111,10 +1949,11 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [owner.toLowerCase(), - newOwner.toLowerCase() - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [ + owner.toLowerCase(), + newOwner.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2123,57 +1962,49 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('replaceOwner(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - owner: string, - newOwner: string, - ): string { + getABIEncodedTransactionData(owner: string, newOwner: string): string { assert.isString('owner', owner); assert.isString('newOwner', newOwner); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('replaceOwner(address,address)', [owner.toLowerCase(), - newOwner.toLowerCase() - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('replaceOwner(address,address)', [ + owner.toLowerCase(), + newOwner.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public executeTransaction = { - async sendTransactionAsync( - transactionId: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.executeTransaction.estimateGasAsync.bind( - self, - transactionId - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(transactionId: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('transactionId', transactionId); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.executeTransaction.estimateGasAsync.bind(self, transactionId), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( transactionId: BigNumber, @@ -2181,51 +2012,45 @@ export class AssetProxyOwnerContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const txHashPromise = self.executeTransaction.sendTransactionAsync(transactionId - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('transactionId', transactionId); + const self = (this as any) as AssetProxyOwnerContract; + const txHashPromise = self.executeTransaction.sendTransactionAsync(transactionId, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - transactionId: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(transactionId: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('transactionId', transactionId); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( transactionId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('transactionId', transactionId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -2235,9 +2060,8 @@ export class AssetProxyOwnerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId - ]); + const self = (this as any) as AssetProxyOwnerContract; + const encodedData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2246,37 +2070,37 @@ export class AssetProxyOwnerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('executeTransaction(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - transactionId: BigNumber, - ): string { + getABIEncodedTransactionData(transactionId: BigNumber): string { assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId - ]); + const self = (this as any) as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('executeTransaction(uint256)', [ + transactionId, + ]); return abiEncodedTransactionData; }, }; -private readonly _subscriptionManager: SubscriptionManager; -public static async deployFrom0xArtifactAsync( + private readonly _subscriptionManager: SubscriptionManager; + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, - _owners: string[], - _assetProxyContracts: string[], - _required: BigNumber, - _secondsTimeLocked: BigNumber, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + _owners: string[], + _assetProxyContracts: string[], + _required: BigNumber, + _secondsTimeLocked: BigNumber, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -2289,12 +2113,21 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); - return AssetProxyOwnerContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, _owners, -_assetProxyContracts, -_required, -_secondsTimeLocked -); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, + ); + return AssetProxyOwnerContract.deployAsync( + bytecode, + abi, + provider, + txDefaults, + logDecodeDependenciesAbiOnly, + _owners, + _assetProxyContracts, + _required, + _secondsTimeLocked, + ); } public static async deployAsync( bytecode: string, @@ -2302,10 +2135,10 @@ _secondsTimeLocked supportedProvider: SupportedProvider, txDefaults: Partial, logDecodeDependencies: { [contractName: string]: ContractAbi }, - _owners: string[], - _assetProxyContracts: string[], - _required: BigNumber, - _secondsTimeLocked: BigNumber, + _owners: string[], + _assetProxyContracts: string[], + _required: BigNumber, + _secondsTimeLocked: BigNumber, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -2315,29 +2148,17 @@ _secondsTimeLocked ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_owners, -_assetProxyContracts, -_required, -_secondsTimeLocked -] = BaseContract._formatABIDataItemList( + [_owners, _assetProxyContracts, _required, _secondsTimeLocked] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [_owners, -_assetProxyContracts, -_required, -_secondsTimeLocked -], + [_owners, _assetProxyContracts, _required, _secondsTimeLocked], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_owners, -_assetProxyContracts, -_required, -_secondsTimeLocked -]); + const txData = deployInfo.encode(bytecode, [_owners, _assetProxyContracts, _required, _secondsTimeLocked]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -2345,22 +2166,22 @@ _secondsTimeLocked logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`AssetProxyOwner successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new AssetProxyOwnerContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); - contractInstance.constructorArgs = [_owners, -_assetProxyContracts, -_required, -_secondsTimeLocked -]; + const contractInstance = new AssetProxyOwnerContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + logDecodeDependencies, + ); + contractInstance.constructorArgs = [_owners, _assetProxyContracts, _required, _secondsTimeLocked]; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -2379,7 +2200,7 @@ _secondsTimeLocked stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2388,13 +2209,12 @@ _secondsTimeLocked }, ], name: 'removeOwner', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2403,13 +2223,12 @@ _secondsTimeLocked }, ], name: 'revokeConfirmation', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2428,7 +2247,7 @@ _secondsTimeLocked stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2451,7 +2270,7 @@ _secondsTimeLocked stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2460,16 +2279,14 @@ _secondsTimeLocked }, ], name: 'executeRemoveAuthorizedAddressAtIndex', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'secondsTimeLocked', outputs: [ { @@ -2481,7 +2298,7 @@ _secondsTimeLocked stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2504,7 +2321,7 @@ _secondsTimeLocked stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2517,13 +2334,12 @@ _secondsTimeLocked }, ], name: 'registerAssetProxy', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2532,13 +2348,12 @@ _secondsTimeLocked }, ], name: 'addOwner', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2557,7 +2372,7 @@ _secondsTimeLocked stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2566,13 +2381,12 @@ _secondsTimeLocked }, ], name: 'changeTimeLock', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2591,7 +2405,7 @@ _secondsTimeLocked stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2610,7 +2424,7 @@ _secondsTimeLocked stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2641,10 +2455,9 @@ _secondsTimeLocked stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'getOwners', outputs: [ { @@ -2656,7 +2469,7 @@ _secondsTimeLocked stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2687,7 +2500,7 @@ _secondsTimeLocked stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2706,10 +2519,9 @@ _secondsTimeLocked stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'transactionCount', outputs: [ { @@ -2721,7 +2533,7 @@ _secondsTimeLocked stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2730,13 +2542,12 @@ _secondsTimeLocked }, ], name: 'changeRequirement', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2745,13 +2556,12 @@ _secondsTimeLocked }, ], name: 'confirmTransaction', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2778,7 +2588,7 @@ _secondsTimeLocked stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -2797,10 +2607,9 @@ _secondsTimeLocked stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'MAX_OWNER_COUNT', outputs: [ { @@ -2812,10 +2621,9 @@ _secondsTimeLocked stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'required', outputs: [ { @@ -2827,7 +2635,7 @@ _secondsTimeLocked stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2840,13 +2648,12 @@ _secondsTimeLocked }, ], name: 'replaceOwner', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -2855,13 +2662,12 @@ _secondsTimeLocked }, ], name: 'executeTransaction', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { inputs: [ { name: '_owners', @@ -2880,22 +2686,19 @@ _secondsTimeLocked type: 'uint256', }, ], - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'constructor', }, - { - inputs: [ - ], - outputs: [ - ], + { + inputs: [], + outputs: [], payable: true, stateMutability: 'payable', type: 'fallback', }, - { + { anonymous: false, inputs: [ { @@ -2910,11 +2713,10 @@ _secondsTimeLocked }, ], name: 'AssetProxyRegistration', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -2929,11 +2731,10 @@ _secondsTimeLocked }, ], name: 'ConfirmationTimeSet', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -2943,11 +2744,10 @@ _secondsTimeLocked }, ], name: 'TimeLockChange', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -2962,11 +2762,10 @@ _secondsTimeLocked }, ], name: 'Confirmation', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -2981,11 +2780,10 @@ _secondsTimeLocked }, ], name: 'Revocation', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -2995,11 +2793,10 @@ _secondsTimeLocked }, ], name: 'Submission', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -3009,11 +2806,10 @@ _secondsTimeLocked }, ], name: 'Execution', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -3023,11 +2819,10 @@ _secondsTimeLocked }, ], name: 'ExecutionFailure', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -3042,11 +2837,10 @@ _secondsTimeLocked }, ], name: 'Deposit', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -3056,11 +2850,10 @@ _secondsTimeLocked }, ], name: 'OwnerAddition', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -3070,11 +2863,10 @@ _secondsTimeLocked }, ], name: 'OwnerRemoval', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -3084,8 +2876,7 @@ _secondsTimeLocked }, ], name: 'RequirementChange', - outputs: [ - ], + outputs: [], type: 'event', }, ] as ContractAbi; @@ -3159,15 +2950,27 @@ _secondsTimeLocked ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { - super('AssetProxyOwner', AssetProxyOwnerContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { + super( + 'AssetProxyOwner', + AssetProxyOwnerContract.ABI(), + address, + supportedProvider, + txDefaults, + logDecodeDependencies, + ); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( AssetProxyOwnerContract.ABI(), this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts index 9c6104b686..305e0b38aa 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts @@ -1,7 +1,7 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract,PromiseWithTransactionHash } from '@0x/base-contract'; +import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -23,7 +23,6 @@ import { assert } from '@0x/assert'; import * as ethers from 'ethers'; // tslint:enable:no-unused-variable - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name @@ -34,8 +33,7 @@ export class CoordinatorContract extends BaseContract { signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('hash', hash); assert.isString('signature', signature); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -46,10 +44,8 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as CoordinatorContract; - const encodedData = self._strictEncodeArguments('getSignerAddress(bytes32,bytes)', [hash, - signature - ]); + const self = (this as any) as CoordinatorContract; + const encodedData = self._strictEncodeArguments('getSignerAddress(bytes32,bytes)', [hash, signature]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -58,38 +54,35 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getSignerAddress(bytes32,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - hash: string, - signature: string, - ): string { + getABIEncodedTransactionData(hash: string, signature: string): string { assert.isString('hash', hash); assert.isString('signature', signature); - const self = this as any as CoordinatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getSignerAddress(bytes32,bytes)', [hash, - signature - ]); + const self = (this as any) as CoordinatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getSignerAddress(bytes32,bytes)', [ + hash, + signature, + ]); return abiEncodedTransactionData; }, }; public getTransactionHash = { async callAsync( - transaction: {salt: BigNumber;signerAddress: string;data: string}, + transaction: { salt: BigNumber; signerAddress: string; data: string }, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { - + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -98,9 +91,10 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as CoordinatorContract; - const encodedData = self._strictEncodeArguments('getTransactionHash((uint256,address,bytes))', [transaction - ]); + const self = (this as any) as CoordinatorContract; + const encodedData = self._strictEncodeArguments('getTransactionHash((uint256,address,bytes))', [ + transaction, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -109,35 +103,38 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + 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); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - transaction: {salt: BigNumber;signerAddress: string;data: string}, - ): string { - - const self = this as any as CoordinatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getTransactionHash((uint256,address,bytes))', [transaction - ]); + getABIEncodedTransactionData(transaction: { salt: BigNumber; signerAddress: string; data: string }): string { + const self = (this as any) as CoordinatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'getTransactionHash((uint256,address,bytes))', + [transaction], + ); return abiEncodedTransactionData; }, }; public getCoordinatorApprovalHash = { async callAsync( - approval: {txOrigin: string;transactionHash: string;transactionSignature: string;approvalExpirationTimeSeconds: BigNumber}, + approval: { + txOrigin: string; + transactionHash: string; + transactionSignature: string; + approvalExpirationTimeSeconds: BigNumber; + }, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { - + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -146,9 +143,11 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as CoordinatorContract; - const encodedData = self._strictEncodeArguments('getCoordinatorApprovalHash((address,bytes32,bytes,uint256))', [approval - ]); + 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, @@ -157,73 +156,81 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + 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); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - approval: {txOrigin: string;transactionHash: string;transactionSignature: string;approvalExpirationTimeSeconds: BigNumber}, - ): string { - - const self = this as any as CoordinatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getCoordinatorApprovalHash((address,bytes32,bytes,uint256))', [approval - ]); + getABIEncodedTransactionData(approval: { + txOrigin: string; + transactionHash: string; + transactionSignature: string; + approvalExpirationTimeSeconds: BigNumber; + }): string { + const self = (this as any) as CoordinatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'getCoordinatorApprovalHash((address,bytes32,bytes,uint256))', + [approval], + ); return abiEncodedTransactionData; }, }; public executeTransaction = { async sendTransactionAsync( - transaction: {salt: BigNumber;signerAddress: string;data: string}, + transaction: { salt: BigNumber; signerAddress: string; data: string }, txOrigin: string, transactionSignature: string, approvalExpirationTimeSeconds: BigNumber[], approvalSignatures: string[], - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - - assert.isString('txOrigin', txOrigin); - assert.isString('transactionSignature', transactionSignature); - assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); - assert.isArray('approvalSignatures', approvalSignatures); - const self = this as any as CoordinatorContract; - const encodedData = self._strictEncodeArguments('executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.executeTransaction.estimateGasAsync.bind( - self, - transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isString('txOrigin', txOrigin); + assert.isString('transactionSignature', transactionSignature); + assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); + assert.isArray('approvalSignatures', approvalSignatures); + const self = (this as any) as CoordinatorContract; + const encodedData = self._strictEncodeArguments( + 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', + [ + transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures, + ], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.executeTransaction.estimateGasAsync.bind( + self, + transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures, + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - transaction: {salt: BigNumber;signerAddress: string;data: string}, + transaction: { salt: BigNumber; signerAddress: string; data: string }, txOrigin: string, transactionSignature: string, approvalExpirationTimeSeconds: BigNumber[], @@ -232,76 +239,78 @@ export class CoordinatorContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - - assert.isString('txOrigin', txOrigin); - assert.isString('transactionSignature', transactionSignature); - assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); - assert.isArray('approvalSignatures', approvalSignatures); - const self = this as any as CoordinatorContract; - const txHashPromise = self.executeTransaction.sendTransactionAsync(transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('txOrigin', txOrigin); + assert.isString('transactionSignature', transactionSignature); + assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); + assert.isArray('approvalSignatures', approvalSignatures); + const self = (this as any) as CoordinatorContract; + const txHashPromise = self.executeTransaction.sendTransactionAsync( + transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - transaction: {salt: BigNumber;signerAddress: string;data: string}, + transaction: { salt: BigNumber; signerAddress: string; data: string }, txOrigin: string, transactionSignature: string, approvalExpirationTimeSeconds: BigNumber[], approvalSignatures: string[], txData?: Partial | undefined, ): Promise { - - assert.isString('txOrigin', txOrigin); - assert.isString('transactionSignature', transactionSignature); - assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); - assert.isArray('approvalSignatures', approvalSignatures); - const self = this as any as CoordinatorContract; - const encodedData = self._strictEncodeArguments('executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('txOrigin', txOrigin); + assert.isString('transactionSignature', transactionSignature); + assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); + assert.isArray('approvalSignatures', approvalSignatures); + const self = (this as any) as CoordinatorContract; + const encodedData = self._strictEncodeArguments( + 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', + [ + transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures, + ], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - transaction: {salt: BigNumber;signerAddress: string;data: string}, + transaction: { salt: BigNumber; signerAddress: string; data: string }, txOrigin: string, transactionSignature: string, approvalExpirationTimeSeconds: BigNumber[], approvalSignatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { - + ): Promise { assert.isString('txOrigin', txOrigin); assert.isString('transactionSignature', transactionSignature); assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); @@ -314,13 +323,17 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as CoordinatorContract; - const encodedData = self._strictEncodeArguments('executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures - ]); + const self = (this as any) as CoordinatorContract; + const encodedData = self._strictEncodeArguments( + 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', + [ + transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures, + ], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -329,45 +342,47 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])'); + const abiEncoder = self._lookupAbiEncoder( + 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - transaction: {salt: BigNumber;signerAddress: string;data: string}, - txOrigin: string, - transactionSignature: string, - approvalExpirationTimeSeconds: BigNumber[], - approvalSignatures: string[], - ): string { - + transaction: { salt: BigNumber; signerAddress: string; data: string }, + txOrigin: string, + transactionSignature: string, + approvalExpirationTimeSeconds: BigNumber[], + approvalSignatures: string[], + ): string { assert.isString('txOrigin', txOrigin); assert.isString('transactionSignature', transactionSignature); assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); assert.isArray('approvalSignatures', approvalSignatures); - const self = this as any as CoordinatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures - ]); + const self = (this as any) as CoordinatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', + [ + transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures, + ], + ); return abiEncodedTransactionData; }, }; public EIP712_EXCHANGE_DOMAIN_HASH = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -376,7 +391,7 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as CoordinatorContract; + const self = (this as any) as CoordinatorContract; const encodedData = self._strictEncodeArguments('EIP712_EXCHANGE_DOMAIN_HASH()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -386,36 +401,34 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + 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); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as CoordinatorContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as CoordinatorContract; const abiEncodedTransactionData = self._strictEncodeArguments('EIP712_EXCHANGE_DOMAIN_HASH()', []); return abiEncodedTransactionData; }, }; public assertValidCoordinatorApprovals = { async callAsync( - transaction: {salt: BigNumber;signerAddress: string;data: string}, + transaction: { salt: BigNumber; signerAddress: string; data: string }, txOrigin: string, transactionSignature: string, approvalExpirationTimeSeconds: BigNumber[], approvalSignatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { - + ): Promise { assert.isString('txOrigin', txOrigin); assert.isString('transactionSignature', transactionSignature); assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); @@ -428,13 +441,17 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as CoordinatorContract; - const encodedData = self._strictEncodeArguments('assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures - ]); + const self = (this as any) as CoordinatorContract; + const encodedData = self._strictEncodeArguments( + 'assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', + [ + transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures, + ], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -443,36 +460,42 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])'); + const abiEncoder = self._lookupAbiEncoder( + 'assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - transaction: {salt: BigNumber;signerAddress: string;data: string}, - txOrigin: string, - transactionSignature: string, - approvalExpirationTimeSeconds: BigNumber[], - approvalSignatures: string[], - ): string { - + transaction: { salt: BigNumber; signerAddress: string; data: string }, + txOrigin: string, + transactionSignature: string, + approvalExpirationTimeSeconds: BigNumber[], + approvalSignatures: string[], + ): string { assert.isString('txOrigin', txOrigin); assert.isString('transactionSignature', transactionSignature); assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); assert.isArray('approvalSignatures', approvalSignatures); - const self = this as any as CoordinatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction, - txOrigin.toLowerCase(), - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures - ]); + const self = (this as any) as CoordinatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', + [ + transaction, + txOrigin.toLowerCase(), + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures, + ], + ); return abiEncodedTransactionData; }, }; @@ -481,7 +504,21 @@ export class CoordinatorContract extends BaseContract { data: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise + ): Promise< + Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }> > { assert.isString('data', data); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -492,9 +529,8 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as CoordinatorContract; - const encodedData = self._strictEncodeArguments('decodeOrdersFromFillData(bytes)', [data - ]); + const self = (this as any) as CoordinatorContract; + const encodedData = self._strictEncodeArguments('decodeOrdersFromFillData(bytes)', [data]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -503,33 +539,42 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('decodeOrdersFromFillData(bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue< + Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }> + >(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - data: string, - ): string { + getABIEncodedTransactionData(data: string): string { assert.isString('data', data); - const self = this as any as CoordinatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('decodeOrdersFromFillData(bytes)', [data - ]); + const self = (this as any) as CoordinatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('decodeOrdersFromFillData(bytes)', [data]); return abiEncodedTransactionData; }, }; public EIP712_COORDINATOR_DOMAIN_HASH = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -538,7 +583,7 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as CoordinatorContract; + const self = (this as any) as CoordinatorContract; const encodedData = self._strictEncodeArguments('EIP712_COORDINATOR_DOMAIN_HASH()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -548,30 +593,30 @@ export class CoordinatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('EIP712_COORDINATOR_DOMAIN_HASH()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as CoordinatorContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as CoordinatorContract; const abiEncodedTransactionData = self._strictEncodeArguments('EIP712_COORDINATOR_DOMAIN_HASH()', []); return abiEncodedTransactionData; }, }; -public static async deployFrom0xArtifactAsync( + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, - _exchange: string, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + _exchange: string, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -584,9 +629,18 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); - return CoordinatorContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, _exchange -); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, + ); + return CoordinatorContract.deployAsync( + bytecode, + abi, + provider, + txDefaults, + logDecodeDependenciesAbiOnly, + _exchange, + ); } public static async deployAsync( bytecode: string, @@ -594,7 +648,7 @@ public static async deployFrom0xArtifactAsync( supportedProvider: SupportedProvider, txDefaults: Partial, logDecodeDependencies: { [contractName: string]: ContractAbi }, - _exchange: string, + _exchange: string, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -604,20 +658,17 @@ public static async deployFrom0xArtifactAsync( ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_exchange -] = BaseContract._formatABIDataItemList( + [_exchange] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [_exchange -], + [_exchange], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_exchange -]); + const txData = deployInfo.encode(bytecode, [_exchange]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -625,19 +676,22 @@ public static async deployFrom0xArtifactAsync( logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`Coordinator successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new CoordinatorContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); - contractInstance.constructorArgs = [_exchange -]; + const contractInstance = new CoordinatorContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + logDecodeDependencies, + ); + contractInstance.constructorArgs = [_exchange]; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -660,7 +714,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'pure', type: 'function', }, - { + { constant: true, inputs: [ { @@ -679,7 +733,7 @@ public static async deployFrom0xArtifactAsync( name: 'data', type: 'bytes', }, - ] + ], }, ], name: 'getTransactionHash', @@ -693,7 +747,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -716,7 +770,7 @@ public static async deployFrom0xArtifactAsync( name: 'approvalExpirationTimeSeconds', type: 'uint256', }, - ] + ], }, ], name: 'getCoordinatorApprovalHash', @@ -730,7 +784,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -749,7 +803,7 @@ public static async deployFrom0xArtifactAsync( name: 'data', type: 'bytes', }, - ] + ], }, { name: 'txOrigin', @@ -769,16 +823,14 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'executeTransaction', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'EIP712_EXCHANGE_DOMAIN_HASH', outputs: [ { @@ -790,7 +842,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -809,7 +861,7 @@ public static async deployFrom0xArtifactAsync( name: 'data', type: 'bytes', }, - ] + ], }, { name: 'txOrigin', @@ -829,13 +881,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'assertValidCoordinatorApprovals', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -897,17 +948,16 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, ], payable: false, stateMutability: 'pure', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'EIP712_COORDINATOR_DOMAIN_HASH', outputs: [ { @@ -919,15 +969,14 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { inputs: [ { name: '_exchange', type: 'address', }, ], - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'constructor', @@ -935,11 +984,16 @@ public static async deployFrom0xArtifactAsync( ] as ContractAbi; return abi; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { super('Coordinator', CoordinatorContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 717c5cddab..50ea62a44f 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts @@ -1,11 +1,14 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, +import { + BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; + SubscriptionManager, + PromiseWithTransactionHash, +} from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -28,8 +31,7 @@ import { assert } from '@0x/assert'; import * as ethers from 'ethers'; // tslint:enable:no-unused-variable -export type CoordinatorRegistryEventArgs = - | CoordinatorRegistryCoordinatorEndpointSetEventArgs; +export type CoordinatorRegistryEventArgs = CoordinatorRegistryCoordinatorEndpointSetEventArgs; export enum CoordinatorRegistryEvents { CoordinatorEndpointSet = 'CoordinatorEndpointSet', @@ -40,38 +42,30 @@ export interface CoordinatorRegistryCoordinatorEndpointSetEventArgs extends Deco coordinatorEndpoint: string; } - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class CoordinatorRegistryContract extends BaseContract { public setCoordinatorEndpoint = { - async sendTransactionAsync( - coordinatorEndpoint: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('coordinatorEndpoint', coordinatorEndpoint); - const self = this as any as CoordinatorRegistryContract; - const encodedData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.setCoordinatorEndpoint.estimateGasAsync.bind( - self, - coordinatorEndpoint - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(coordinatorEndpoint: string, txData?: Partial | undefined): Promise { + assert.isString('coordinatorEndpoint', coordinatorEndpoint); + const self = (this as any) as CoordinatorRegistryContract; + const encodedData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.setCoordinatorEndpoint.estimateGasAsync.bind(self, coordinatorEndpoint), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( coordinatorEndpoint: string, @@ -79,51 +73,45 @@ export class CoordinatorRegistryContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('coordinatorEndpoint', coordinatorEndpoint); - const self = this as any as CoordinatorRegistryContract; - const txHashPromise = self.setCoordinatorEndpoint.sendTransactionAsync(coordinatorEndpoint - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('coordinatorEndpoint', coordinatorEndpoint); + const self = (this as any) as CoordinatorRegistryContract; + const txHashPromise = self.setCoordinatorEndpoint.sendTransactionAsync(coordinatorEndpoint, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - coordinatorEndpoint: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('coordinatorEndpoint', coordinatorEndpoint); - const self = this as any as CoordinatorRegistryContract; - const encodedData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(coordinatorEndpoint: string, txData?: Partial | undefined): Promise { + assert.isString('coordinatorEndpoint', coordinatorEndpoint); + const self = (this as any) as CoordinatorRegistryContract; + const encodedData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( coordinatorEndpoint: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('coordinatorEndpoint', coordinatorEndpoint); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -133,9 +121,8 @@ export class CoordinatorRegistryContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as CoordinatorRegistryContract; - const encodedData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint - ]); + const self = (this as any) as CoordinatorRegistryContract; + const encodedData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -144,24 +131,24 @@ export class CoordinatorRegistryContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('setCoordinatorEndpoint(string)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - coordinatorEndpoint: string, - ): string { + getABIEncodedTransactionData(coordinatorEndpoint: string): string { assert.isString('coordinatorEndpoint', coordinatorEndpoint); - const self = this as any as CoordinatorRegistryContract; - const abiEncodedTransactionData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint - ]); + const self = (this as any) as CoordinatorRegistryContract; + const abiEncodedTransactionData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [ + coordinatorEndpoint, + ]); return abiEncodedTransactionData; }, }; @@ -170,8 +157,7 @@ export class CoordinatorRegistryContract extends BaseContract { coordinatorOperator: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('coordinatorOperator', coordinatorOperator); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -181,9 +167,10 @@ export class CoordinatorRegistryContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as CoordinatorRegistryContract; - const encodedData = self._strictEncodeArguments('getCoordinatorEndpoint(address)', [coordinatorOperator.toLowerCase() - ]); + const self = (this as any) as CoordinatorRegistryContract; + const encodedData = self._strictEncodeArguments('getCoordinatorEndpoint(address)', [ + coordinatorOperator.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -192,33 +179,33 @@ export class CoordinatorRegistryContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getCoordinatorEndpoint(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - coordinatorOperator: string, - ): string { + getABIEncodedTransactionData(coordinatorOperator: string): string { assert.isString('coordinatorOperator', coordinatorOperator); - const self = this as any as CoordinatorRegistryContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getCoordinatorEndpoint(address)', [coordinatorOperator.toLowerCase() - ]); + const self = (this as any) as CoordinatorRegistryContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getCoordinatorEndpoint(address)', [ + coordinatorOperator.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; -private readonly _subscriptionManager: SubscriptionManager; -public static async deployFrom0xArtifactAsync( + private readonly _subscriptionManager: SubscriptionManager; + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -231,8 +218,17 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); - return CoordinatorRegistryContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, + ); + return CoordinatorRegistryContract.deployAsync( + bytecode, + abi, + provider, + txDefaults, + logDecodeDependenciesAbiOnly, + ); } public static async deployAsync( bytecode: string, @@ -249,17 +245,13 @@ public static async deployFrom0xArtifactAsync( ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); + [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -267,18 +259,22 @@ public static async deployFrom0xArtifactAsync( logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`CoordinatorRegistry successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new CoordinatorRegistryContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); + const contractInstance = new CoordinatorRegistryContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + logDecodeDependencies, + ); contractInstance.constructorArgs = []; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: false, inputs: [ { @@ -287,13 +283,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'setCoordinatorEndpoint', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -312,16 +307,14 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { - inputs: [ - ], - outputs: [ - ], + { + inputs: [], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'constructor', }, - { + { anonymous: false, inputs: [ { @@ -336,8 +329,7 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'CoordinatorEndpointSet', - outputs: [ - ], + outputs: [], type: 'event', }, ] as ContractAbi; @@ -411,15 +403,27 @@ public static async deployFrom0xArtifactAsync( ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { - super('CoordinatorRegistry', CoordinatorRegistryContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { + super( + 'CoordinatorRegistry', + CoordinatorRegistryContract.ABI(), + address, + supportedProvider, + txDefaults, + logDecodeDependencies, + ); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( CoordinatorRegistryContract.ABI(), this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 86ae2b9e90..7947130b0d 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 @@ -1,11 +1,14 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, +import { + BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; + SubscriptionManager, + PromiseWithTransactionHash, +} from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -28,9 +31,7 @@ import { assert } from '@0x/assert'; import * as ethers from 'ethers'; // tslint:enable:no-unused-variable -export type DummyERC20TokenEventArgs = - | DummyERC20TokenTransferEventArgs - | DummyERC20TokenApprovalEventArgs; +export type DummyERC20TokenEventArgs = DummyERC20TokenTransferEventArgs | DummyERC20TokenApprovalEventArgs; export enum DummyERC20TokenEvents { Transfer = 'Transfer', @@ -49,17 +50,12 @@ export interface DummyERC20TokenApprovalEventArgs extends DecodedLogArgs { _value: BigNumber; } - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class DummyERC20TokenContract extends BaseContract { public name = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -68,7 +64,7 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC20TokenContract; + const self = (this as any) as DummyERC20TokenContract; const encodedData = self._strictEncodeArguments('name()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -78,20 +74,20 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('name()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as DummyERC20TokenContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as DummyERC20TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('name()', []); return abiEncodedTransactionData; }, @@ -100,33 +96,30 @@ export class DummyERC20TokenContract extends BaseContract { async sendTransactionAsync( _spender: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind( - self, + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ _spender.toLowerCase(), - _value - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _value, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.approve.estimateGasAsync.bind(self, _spender.toLowerCase(), _value), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _spender: string, @@ -135,57 +128,55 @@ export class DummyERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const txHashPromise = self.approve.sendTransactionAsync(_spender.toLowerCase(), - _value - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = (this as any) as DummyERC20TokenContract; + const txHashPromise = self.approve.sendTransactionAsync(_spender.toLowerCase(), _value, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _spender: string, _value: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + _spender.toLowerCase(), + _value, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _spender: string, _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -196,10 +187,11 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), - _value - ]); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + _spender.toLowerCase(), + _value, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -208,36 +200,31 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _spender: string, - _value: BigNumber, - ): string { + getABIEncodedTransactionData(_spender: string, _value: BigNumber): string { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), - _value - ]); + const self = (this as any) as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [ + _spender.toLowerCase(), + _value, + ]); return abiEncodedTransactionData; }, }; public totalSupply = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -246,7 +233,7 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC20TokenContract; + const self = (this as any) as DummyERC20TokenContract; const encodedData = self._strictEncodeArguments('totalSupply()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -256,20 +243,20 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('totalSupply()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as DummyERC20TokenContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as DummyERC20TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('totalSupply()', []); return abiEncodedTransactionData; }, @@ -279,36 +266,32 @@ export class DummyERC20TokenContract extends BaseContract { _from: string, _to: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind( - self, + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ _from.toLowerCase(), _to.toLowerCase(), - _value - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _value, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferFrom.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _value), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -318,25 +301,27 @@ export class DummyERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const txHashPromise = self.transferFrom.sendTransactionAsync(_from.toLowerCase(), - _to.toLowerCase(), - _value - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as DummyERC20TokenContract; + const txHashPromise = self.transferFrom.sendTransactionAsync( + _from.toLowerCase(), + _to.toLowerCase(), + _value, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -344,28 +329,29 @@ export class DummyERC20TokenContract extends BaseContract { _value: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _value, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -373,8 +359,7 @@ export class DummyERC20TokenContract extends BaseContract { _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_value', _value); @@ -386,11 +371,12 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _value - ]); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _value, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -399,39 +385,33 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _value: BigNumber, - ): string { + getABIEncodedTransactionData(_from: string, _to: string, _value: BigNumber): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _value - ]); + const self = (this as any) as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _value, + ]); return abiEncodedTransactionData; }, }; public decimals = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -440,7 +420,7 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC20TokenContract; + const self = (this as any) as DummyERC20TokenContract; const encodedData = self._strictEncodeArguments('decimals()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -450,20 +430,20 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('decimals()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as DummyERC20TokenContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as DummyERC20TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('decimals()', []); return abiEncodedTransactionData; }, @@ -473,8 +453,7 @@ export class DummyERC20TokenContract extends BaseContract { _owner: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -484,9 +463,8 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() - ]); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -495,33 +473,27 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _owner: string, - ): string { + getABIEncodedTransactionData(_owner: string): string { assert.isString('_owner', _owner); - const self = this as any as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() - ]); + const self = (this as any) as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); return abiEncodedTransactionData; }, }; public owner = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -530,7 +502,7 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC20TokenContract; + const self = (this as any) as DummyERC20TokenContract; const encodedData = self._strictEncodeArguments('owner()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -540,30 +512,26 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as DummyERC20TokenContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as DummyERC20TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); return abiEncodedTransactionData; }, }; public symbol = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -572,7 +540,7 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC20TokenContract; + const self = (this as any) as DummyERC20TokenContract; const encodedData = self._strictEncodeArguments('symbol()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -582,51 +550,44 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('symbol()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as DummyERC20TokenContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as DummyERC20TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('symbol()', []); return abiEncodedTransactionData; }, }; public mint = { - async sendTransactionAsync( - _value: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('mint(uint256)', [_value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.mint.estimateGasAsync.bind( - self, - _value - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(_value: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('_value', _value); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('mint(uint256)', [_value]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.mint.estimateGasAsync.bind(self, _value), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _value: BigNumber, @@ -634,51 +595,41 @@ export class DummyERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const txHashPromise = self.mint.sendTransactionAsync(_value - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('_value', _value); + const self = (this as any) as DummyERC20TokenContract; + const txHashPromise = self.mint.sendTransactionAsync(_value, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - _value: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('mint(uint256)', [_value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(_value: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('_value', _value); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('mint(uint256)', [_value]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - _value: BigNumber, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(_value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isBigNumber('_value', _value); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -688,9 +639,8 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('mint(uint256)', [_value - ]); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('mint(uint256)', [_value]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -699,24 +649,22 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('mint(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _value: BigNumber, - ): string { + getABIEncodedTransactionData(_value: BigNumber): string { assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('mint(uint256)', [_value - ]); + const self = (this as any) as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('mint(uint256)', [_value]); return abiEncodedTransactionData; }, }; @@ -724,33 +672,27 @@ export class DummyERC20TokenContract extends BaseContract { async sendTransactionAsync( _to: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transfer.estimateGasAsync.bind( - self, - _to.toLowerCase(), - _value - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transfer.estimateGasAsync.bind(self, _to.toLowerCase(), _value), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _to: string, @@ -759,57 +701,48 @@ export class DummyERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const txHashPromise = self.transfer.sendTransactionAsync(_to.toLowerCase(), - _value - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as DummyERC20TokenContract; + const txHashPromise = self.transfer.sendTransactionAsync(_to.toLowerCase(), _value, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - _to: string, - _value: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(_to: string, _value: BigNumber, txData?: Partial | undefined): Promise { + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _to: string, _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_to', _to); assert.isBigNumber('_value', _value); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -820,10 +753,8 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), - _value - ]); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -832,27 +763,26 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _to: string, - _value: BigNumber, - ): string { + getABIEncodedTransactionData(_to: string, _value: BigNumber): string { assert.isString('_to', _to); assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), - _value - ]); + const self = (this as any) as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [ + _to.toLowerCase(), + _value, + ]); return abiEncodedTransactionData; }, }; @@ -862,8 +792,7 @@ export class DummyERC20TokenContract extends BaseContract { _spender: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.isString('_spender', _spender); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -874,10 +803,11 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('allowance(address,address)', [_owner.toLowerCase(), - _spender.toLowerCase() - ]); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('allowance(address,address)', [ + _owner.toLowerCase(), + _spender.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -886,27 +816,26 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _owner: string, - _spender: string, - ): string { + getABIEncodedTransactionData(_owner: string, _spender: string): string { assert.isString('_owner', _owner); assert.isString('_spender', _spender); - const self = this as any as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [_owner.toLowerCase(), - _spender.toLowerCase() - ]); + const self = (this as any) as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [ + _owner.toLowerCase(), + _spender.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; @@ -914,33 +843,30 @@ export class DummyERC20TokenContract extends BaseContract { async sendTransactionAsync( _target: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_target', _target); - assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [_target.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.setBalance.estimateGasAsync.bind( - self, + assert.isString('_target', _target); + assert.isBigNumber('_value', _value); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [ _target.toLowerCase(), - _value - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _value, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.setBalance.estimateGasAsync.bind(self, _target.toLowerCase(), _value), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _target: string, @@ -949,57 +875,55 @@ export class DummyERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_target', _target); - assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const txHashPromise = self.setBalance.sendTransactionAsync(_target.toLowerCase(), - _value - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_target', _target); + assert.isBigNumber('_value', _value); + const self = (this as any) as DummyERC20TokenContract; + const txHashPromise = self.setBalance.sendTransactionAsync(_target.toLowerCase(), _value, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _target: string, _value: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_target', _target); - assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [_target.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_target', _target); + assert.isBigNumber('_value', _value); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [ + _target.toLowerCase(), + _value, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _target: string, _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_target', _target); assert.isBigNumber('_value', _value); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -1010,10 +934,11 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [_target.toLowerCase(), - _value - ]); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [ + _target.toLowerCase(), + _value, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1022,57 +947,49 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('setBalance(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _target: string, - _value: BigNumber, - ): string { + getABIEncodedTransactionData(_target: string, _value: BigNumber): string { assert.isString('_target', _target); assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('setBalance(address,uint256)', [_target.toLowerCase(), - _value - ]); + const self = (this as any) as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('setBalance(address,uint256)', [ + _target.toLowerCase(), + _value, + ]); return abiEncodedTransactionData; }, }; public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('newOwner', newOwner); - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind( - self, - newOwner.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( newOwner: string, @@ -1080,51 +997,41 @@ export class DummyERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('newOwner', newOwner); - const self = this as any as DummyERC20TokenContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('newOwner', newOwner); + const self = (this as any) as DummyERC20TokenContract; + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - newOwner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('newOwner', newOwner); - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - newOwner: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1134,9 +1041,8 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); + const self = (this as any) as DummyERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1145,33 +1051,29 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - newOwner: string, - ): string { + getABIEncodedTransactionData(newOwner: string): string { assert.isString('newOwner', newOwner); - const self = this as any as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); + const self = (this as any) as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ + newOwner.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public MAX_MINT_AMOUNT = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -1180,7 +1082,7 @@ export class DummyERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC20TokenContract; + const self = (this as any) as DummyERC20TokenContract; const encodedData = self._strictEncodeArguments('MAX_MINT_AMOUNT()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1190,34 +1092,34 @@ export class DummyERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('MAX_MINT_AMOUNT()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as DummyERC20TokenContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as DummyERC20TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('MAX_MINT_AMOUNT()', []); return abiEncodedTransactionData; }, }; -private readonly _subscriptionManager: SubscriptionManager; -public static async deployFrom0xArtifactAsync( + private readonly _subscriptionManager: SubscriptionManager; + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, - _name: string, - _symbol: string, - _decimals: BigNumber, - _totalSupply: BigNumber, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + _name: string, + _symbol: string, + _decimals: BigNumber, + _totalSupply: BigNumber, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -1230,12 +1132,21 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); - return DummyERC20TokenContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, _name, -_symbol, -_decimals, -_totalSupply -); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, + ); + return DummyERC20TokenContract.deployAsync( + bytecode, + abi, + provider, + txDefaults, + logDecodeDependenciesAbiOnly, + _name, + _symbol, + _decimals, + _totalSupply, + ); } public static async deployAsync( bytecode: string, @@ -1243,10 +1154,10 @@ _totalSupply supportedProvider: SupportedProvider, txDefaults: Partial, logDecodeDependencies: { [contractName: string]: ContractAbi }, - _name: string, - _symbol: string, - _decimals: BigNumber, - _totalSupply: BigNumber, + _name: string, + _symbol: string, + _decimals: BigNumber, + _totalSupply: BigNumber, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -1256,29 +1167,17 @@ _totalSupply ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_name, -_symbol, -_decimals, -_totalSupply -] = BaseContract._formatABIDataItemList( + [_name, _symbol, _decimals, _totalSupply] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [_name, -_symbol, -_decimals, -_totalSupply -], + [_name, _symbol, _decimals, _totalSupply], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_name, -_symbol, -_decimals, -_totalSupply -]); + const txData = deployInfo.encode(bytecode, [_name, _symbol, _decimals, _totalSupply]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -1286,25 +1185,24 @@ _totalSupply logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`DummyERC20Token successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new DummyERC20TokenContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); - contractInstance.constructorArgs = [_name, -_symbol, -_decimals, -_totalSupply -]; + const contractInstance = new DummyERC20TokenContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + logDecodeDependencies, + ); + contractInstance.constructorArgs = [_name, _symbol, _decimals, _totalSupply]; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'name', outputs: [ { @@ -1316,7 +1214,7 @@ _totalSupply stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1339,10 +1237,9 @@ _totalSupply stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'totalSupply', outputs: [ { @@ -1354,7 +1251,7 @@ _totalSupply stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1381,10 +1278,9 @@ _totalSupply stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'decimals', outputs: [ { @@ -1396,7 +1292,7 @@ _totalSupply stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1415,10 +1311,9 @@ _totalSupply stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'owner', outputs: [ { @@ -1430,10 +1325,9 @@ _totalSupply stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'symbol', outputs: [ { @@ -1445,7 +1339,7 @@ _totalSupply stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1454,13 +1348,12 @@ _totalSupply }, ], name: 'mint', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1483,7 +1376,7 @@ _totalSupply stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1506,7 +1399,7 @@ _totalSupply stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1519,13 +1412,12 @@ _totalSupply }, ], name: 'setBalance', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1534,16 +1426,14 @@ _totalSupply }, ], name: 'transferOwnership', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'MAX_MINT_AMOUNT', outputs: [ { @@ -1555,7 +1445,7 @@ _totalSupply stateMutability: 'view', type: 'function', }, - { + { inputs: [ { name: '_name', @@ -1574,13 +1464,12 @@ _totalSupply type: 'uint256', }, ], - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'constructor', }, - { + { anonymous: false, inputs: [ { @@ -1600,11 +1489,10 @@ _totalSupply }, ], name: 'Transfer', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1624,8 +1512,7 @@ _totalSupply }, ], name: 'Approval', - outputs: [ - ], + outputs: [], type: 'event', }, ] as ContractAbi; @@ -1699,15 +1586,27 @@ _totalSupply ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { - super('DummyERC20Token', DummyERC20TokenContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { + super( + 'DummyERC20Token', + DummyERC20TokenContract.ABI(), + address, + supportedProvider, + txDefaults, + logDecodeDependencies, + ); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( DummyERC20TokenContract.ABI(), this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 9f3e0bad87..c3ad0fed54 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 @@ -1,11 +1,14 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, +import { + BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; + SubscriptionManager, + PromiseWithTransactionHash, +} from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -57,17 +60,12 @@ export interface DummyERC721TokenApprovalForAllEventArgs extends DecodedLogArgs _approved: boolean; } - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class DummyERC721TokenContract extends BaseContract { public name = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -76,7 +74,7 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC721TokenContract; + const self = (this as any) as DummyERC721TokenContract; const encodedData = self._strictEncodeArguments('name()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -86,20 +84,20 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('name()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as DummyERC721TokenContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as DummyERC721TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('name()', []); return abiEncodedTransactionData; }, @@ -109,8 +107,7 @@ export class DummyERC721TokenContract extends BaseContract { _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('_tokenId', _tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -120,9 +117,8 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId - ]); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -131,24 +127,22 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getApproved(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _tokenId: BigNumber, - ): string { + getABIEncodedTransactionData(_tokenId: BigNumber): string { assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId - ]); + const self = (this as any) as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId]); return abiEncodedTransactionData; }, }; @@ -156,33 +150,30 @@ export class DummyERC721TokenContract extends BaseContract { async sendTransactionAsync( _approved: string, _tokenId: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_approved', _approved); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(), - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind( - self, + assert.isString('_approved', _approved); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ _approved.toLowerCase(), - _tokenId - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _tokenId, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.approve.estimateGasAsync.bind(self, _approved.toLowerCase(), _tokenId), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _approved: string, @@ -191,57 +182,55 @@ export class DummyERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_approved', _approved); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const txHashPromise = self.approve.sendTransactionAsync(_approved.toLowerCase(), - _tokenId - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_approved', _approved); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as DummyERC721TokenContract; + const txHashPromise = self.approve.sendTransactionAsync(_approved.toLowerCase(), _tokenId, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _approved: string, _tokenId: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_approved', _approved); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(), - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_approved', _approved); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + _approved.toLowerCase(), + _tokenId, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _approved: string, _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_approved', _approved); assert.isBigNumber('_tokenId', _tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -252,10 +241,11 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(), - _tokenId - ]); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + _approved.toLowerCase(), + _tokenId, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -264,27 +254,26 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _approved: string, - _tokenId: BigNumber, - ): string { + getABIEncodedTransactionData(_approved: string, _tokenId: BigNumber): string { assert.isString('_approved', _approved); assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(), - _tokenId - ]); + const self = (this as any) as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [ + _approved.toLowerCase(), + _tokenId, + ]); return abiEncodedTransactionData; }, }; @@ -293,36 +282,32 @@ export class DummyERC721TokenContract extends BaseContract { _from: string, _to: string, _tokenId: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind( - self, + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ _from.toLowerCase(), _to.toLowerCase(), - _tokenId - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _tokenId, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferFrom.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _tokenId), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -332,25 +317,27 @@ export class DummyERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const txHashPromise = self.transferFrom.sendTransactionAsync(_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as DummyERC721TokenContract; + const txHashPromise = self.transferFrom.sendTransactionAsync( + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -358,28 +345,29 @@ export class DummyERC721TokenContract extends BaseContract { _tokenId: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -387,8 +375,7 @@ export class DummyERC721TokenContract extends BaseContract { _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); @@ -400,11 +387,12 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - ]); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -413,30 +401,28 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _tokenId: BigNumber, - ): string { + getABIEncodedTransactionData(_from: string, _to: string, _tokenId: BigNumber): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - ]); + const self = (this as any) as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + ]); return abiEncodedTransactionData; }, }; @@ -444,33 +430,27 @@ export class DummyERC721TokenContract extends BaseContract { async sendTransactionAsync( _to: string, _tokenId: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to.toLowerCase(), - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.mint.estimateGasAsync.bind( - self, - _to.toLowerCase(), - _tokenId - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to.toLowerCase(), _tokenId]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.mint.estimateGasAsync.bind(self, _to.toLowerCase(), _tokenId), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _to: string, @@ -479,57 +459,52 @@ export class DummyERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const txHashPromise = self.mint.sendTransactionAsync(_to.toLowerCase(), - _tokenId - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as DummyERC721TokenContract; + const txHashPromise = self.mint.sendTransactionAsync(_to.toLowerCase(), _tokenId, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _to: string, _tokenId: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to.toLowerCase(), - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to.toLowerCase(), _tokenId]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _to: string, _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -540,10 +515,8 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to.toLowerCase(), - _tokenId - ]); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to.toLowerCase(), _tokenId]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -552,27 +525,26 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('mint(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _to: string, - _tokenId: BigNumber, - ): string { + getABIEncodedTransactionData(_to: string, _tokenId: BigNumber): string { assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('mint(address,uint256)', [_to.toLowerCase(), - _tokenId - ]); + const self = (this as any) as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('mint(address,uint256)', [ + _to.toLowerCase(), + _tokenId, + ]); return abiEncodedTransactionData; }, }; @@ -581,36 +553,32 @@ export class DummyERC721TokenContract extends BaseContract { _from: string, _to: string, _tokenId: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.safeTransferFrom1.estimateGasAsync.bind( - self, + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ _from.toLowerCase(), _to.toLowerCase(), - _tokenId - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _tokenId, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.safeTransferFrom1.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _tokenId), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -620,25 +588,27 @@ export class DummyERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const txHashPromise = self.safeTransferFrom1.sendTransactionAsync(_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as DummyERC721TokenContract; + const txHashPromise = self.safeTransferFrom1.sendTransactionAsync( + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -646,28 +616,29 @@ export class DummyERC721TokenContract extends BaseContract { _tokenId: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -675,8 +646,7 @@ export class DummyERC721TokenContract extends BaseContract { _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); @@ -688,11 +658,12 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - ]); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -701,30 +672,28 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _tokenId: BigNumber, - ): string { + getABIEncodedTransactionData(_from: string, _to: string, _tokenId: BigNumber): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - ]); + const self = (this as any) as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + ]); return abiEncodedTransactionData; }, }; @@ -733,8 +702,7 @@ export class DummyERC721TokenContract extends BaseContract { _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('_tokenId', _tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -744,9 +712,8 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId - ]); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -755,24 +722,22 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('ownerOf(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _tokenId: BigNumber, - ): string { + getABIEncodedTransactionData(_tokenId: BigNumber): string { assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId - ]); + const self = (this as any) as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId]); return abiEncodedTransactionData; }, }; @@ -781,8 +746,7 @@ export class DummyERC721TokenContract extends BaseContract { _owner: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -792,9 +756,8 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() - ]); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -803,33 +766,27 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _owner: string, - ): string { + getABIEncodedTransactionData(_owner: string): string { assert.isString('_owner', _owner); - const self = this as any as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() - ]); + const self = (this as any) as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); return abiEncodedTransactionData; }, }; public owner = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -838,7 +795,7 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC721TokenContract; + const self = (this as any) as DummyERC721TokenContract; const encodedData = self._strictEncodeArguments('owner()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -848,30 +805,26 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as DummyERC721TokenContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as DummyERC721TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); return abiEncodedTransactionData; }, }; public symbol = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -880,7 +833,7 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC721TokenContract; + const self = (this as any) as DummyERC721TokenContract; const encodedData = self._strictEncodeArguments('symbol()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -890,20 +843,20 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('symbol()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as DummyERC721TokenContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as DummyERC721TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('symbol()', []); return abiEncodedTransactionData; }, @@ -912,33 +865,27 @@ export class DummyERC721TokenContract extends BaseContract { async sendTransactionAsync( _owner: string, _tokenId: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_owner', _owner); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner.toLowerCase(), - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.burn.estimateGasAsync.bind( - self, - _owner.toLowerCase(), - _tokenId - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isString('_owner', _owner); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner.toLowerCase(), _tokenId]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.burn.estimateGasAsync.bind(self, _owner.toLowerCase(), _tokenId), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _owner: string, @@ -947,57 +894,52 @@ export class DummyERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_owner', _owner); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const txHashPromise = self.burn.sendTransactionAsync(_owner.toLowerCase(), - _tokenId - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_owner', _owner); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as DummyERC721TokenContract; + const txHashPromise = self.burn.sendTransactionAsync(_owner.toLowerCase(), _tokenId, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _owner: string, _tokenId: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_owner', _owner); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner.toLowerCase(), - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_owner', _owner); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner.toLowerCase(), _tokenId]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _owner: string, _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.isBigNumber('_tokenId', _tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -1008,10 +950,8 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner.toLowerCase(), - _tokenId - ]); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner.toLowerCase(), _tokenId]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1020,27 +960,26 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('burn(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _owner: string, - _tokenId: BigNumber, - ): string { + getABIEncodedTransactionData(_owner: string, _tokenId: BigNumber): string { assert.isString('_owner', _owner); assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('burn(address,uint256)', [_owner.toLowerCase(), - _tokenId - ]); + const self = (this as any) as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('burn(address,uint256)', [ + _owner.toLowerCase(), + _tokenId, + ]); return abiEncodedTransactionData; }, }; @@ -1048,33 +987,30 @@ export class DummyERC721TokenContract extends BaseContract { async sendTransactionAsync( _operator: string, _approved: boolean, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_operator', _operator); - assert.isBoolean('_approved', _approved); - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(), - _approved - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.setApprovalForAll.estimateGasAsync.bind( - self, + assert.isString('_operator', _operator); + assert.isBoolean('_approved', _approved); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ _operator.toLowerCase(), - _approved - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _approved, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.setApprovalForAll.estimateGasAsync.bind(self, _operator.toLowerCase(), _approved), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _operator: string, @@ -1083,57 +1019,59 @@ export class DummyERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_operator', _operator); - assert.isBoolean('_approved', _approved); - const self = this as any as DummyERC721TokenContract; - const txHashPromise = self.setApprovalForAll.sendTransactionAsync(_operator.toLowerCase(), - _approved - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_operator', _operator); + assert.isBoolean('_approved', _approved); + const self = (this as any) as DummyERC721TokenContract; + const txHashPromise = self.setApprovalForAll.sendTransactionAsync( + _operator.toLowerCase(), + _approved, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _operator: string, _approved: boolean, txData?: Partial | undefined, ): Promise { - assert.isString('_operator', _operator); - assert.isBoolean('_approved', _approved); - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(), - _approved - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_operator', _operator); + assert.isBoolean('_approved', _approved); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ + _operator.toLowerCase(), + _approved, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _operator: string, _approved: boolean, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_operator', _operator); assert.isBoolean('_approved', _approved); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -1144,10 +1082,11 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(), - _approved - ]); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ + _operator.toLowerCase(), + _approved, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1156,27 +1095,26 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _operator: string, - _approved: boolean, - ): string { + getABIEncodedTransactionData(_operator: string, _approved: boolean): string { assert.isString('_operator', _operator); assert.isBoolean('_approved', _approved); - const self = this as any as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(), - _approved - ]); + const self = (this as any) as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ + _operator.toLowerCase(), + _approved, + ]); return abiEncodedTransactionData; }, }; @@ -1186,39 +1124,40 @@ export class DummyERC721TokenContract extends BaseContract { _to: string, _tokenId: BigNumber, _data: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - assert.isString('_data', _data); - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.safeTransferFrom2.estimateGasAsync.bind( - self, + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + assert.isString('_data', _data); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [ _from.toLowerCase(), _to.toLowerCase(), _tokenId, - _data - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _data, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.safeTransferFrom2.estimateGasAsync.bind( + self, + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data, + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -1229,27 +1168,29 @@ export class DummyERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - assert.isString('_data', _data); - const self = this as any as DummyERC721TokenContract; - const txHashPromise = self.safeTransferFrom2.sendTransactionAsync(_from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + assert.isString('_data', _data); + const self = (this as any) as DummyERC721TokenContract; + const txHashPromise = self.safeTransferFrom2.sendTransactionAsync( + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -1258,30 +1199,31 @@ export class DummyERC721TokenContract extends BaseContract { _data: string, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - assert.isString('_data', _data); - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + assert.isString('_data', _data); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -1290,8 +1232,7 @@ export class DummyERC721TokenContract extends BaseContract { _data: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); @@ -1304,12 +1245,13 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data - ]); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1318,33 +1260,28 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _tokenId: BigNumber, - _data: string, - ): string { + getABIEncodedTransactionData(_from: string, _to: string, _tokenId: BigNumber, _data: string): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); assert.isString('_data', _data); - const self = this as any as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data - ]); + const self = (this as any) as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'safeTransferFrom(address,address,uint256,bytes)', + [_from.toLowerCase(), _to.toLowerCase(), _tokenId, _data], + ); return abiEncodedTransactionData; }, }; @@ -1354,8 +1291,7 @@ export class DummyERC721TokenContract extends BaseContract { _operator: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.isString('_operator', _operator); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -1366,10 +1302,11 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('isApprovedForAll(address,address)', [_owner.toLowerCase(), - _operator.toLowerCase() - ]); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('isApprovedForAll(address,address)', [ + _owner.toLowerCase(), + _operator.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1378,57 +1315,49 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isApprovedForAll(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _owner: string, - _operator: string, - ): string { + getABIEncodedTransactionData(_owner: string, _operator: string): string { assert.isString('_owner', _owner); assert.isString('_operator', _operator); - const self = this as any as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('isApprovedForAll(address,address)', [_owner.toLowerCase(), - _operator.toLowerCase() - ]); + const self = (this as any) as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isApprovedForAll(address,address)', [ + _owner.toLowerCase(), + _operator.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('newOwner', newOwner); - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind( - self, - newOwner.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( newOwner: string, @@ -1436,51 +1365,41 @@ export class DummyERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('newOwner', newOwner); - const self = this as any as DummyERC721TokenContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('newOwner', newOwner); + const self = (this as any) as DummyERC721TokenContract; + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - newOwner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('newOwner', newOwner); - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - newOwner: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1490,9 +1409,8 @@ export class DummyERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); + const self = (this as any) as DummyERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1501,35 +1419,35 @@ export class DummyERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - newOwner: string, - ): string { + getABIEncodedTransactionData(newOwner: string): string { assert.isString('newOwner', newOwner); - const self = this as any as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); + const self = (this as any) as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ + newOwner.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; -private readonly _subscriptionManager: SubscriptionManager; -public static async deployFrom0xArtifactAsync( + private readonly _subscriptionManager: SubscriptionManager; + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, - _name: string, - _symbol: string, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + _name: string, + _symbol: string, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -1542,10 +1460,19 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); - return DummyERC721TokenContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, _name, -_symbol -); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, + ); + return DummyERC721TokenContract.deployAsync( + bytecode, + abi, + provider, + txDefaults, + logDecodeDependenciesAbiOnly, + _name, + _symbol, + ); } public static async deployAsync( bytecode: string, @@ -1553,8 +1480,8 @@ _symbol supportedProvider: SupportedProvider, txDefaults: Partial, logDecodeDependencies: { [contractName: string]: ContractAbi }, - _name: string, - _symbol: string, + _name: string, + _symbol: string, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -1564,23 +1491,17 @@ _symbol ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_name, -_symbol -] = BaseContract._formatABIDataItemList( + [_name, _symbol] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [_name, -_symbol -], + [_name, _symbol], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_name, -_symbol -]); + const txData = deployInfo.encode(bytecode, [_name, _symbol]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -1588,23 +1509,24 @@ _symbol logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`DummyERC721Token successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new DummyERC721TokenContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); - contractInstance.constructorArgs = [_name, -_symbol -]; + const contractInstance = new DummyERC721TokenContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + logDecodeDependencies, + ); + contractInstance.constructorArgs = [_name, _symbol]; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'name', outputs: [ { @@ -1616,7 +1538,7 @@ _symbol stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1635,7 +1557,7 @@ _symbol stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1648,13 +1570,12 @@ _symbol }, ], name: 'approve', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1671,13 +1592,12 @@ _symbol }, ], name: 'transferFrom', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1690,13 +1610,12 @@ _symbol }, ], name: 'mint', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1713,13 +1632,12 @@ _symbol }, ], name: 'safeTransferFrom', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1738,7 +1656,7 @@ _symbol stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1757,10 +1675,9 @@ _symbol stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'owner', outputs: [ { @@ -1772,10 +1689,9 @@ _symbol stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'symbol', outputs: [ { @@ -1787,7 +1703,7 @@ _symbol stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1800,13 +1716,12 @@ _symbol }, ], name: 'burn', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1819,13 +1734,12 @@ _symbol }, ], name: 'setApprovalForAll', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1846,13 +1760,12 @@ _symbol }, ], name: 'safeTransferFrom', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1875,7 +1788,7 @@ _symbol stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1884,13 +1797,12 @@ _symbol }, ], name: 'transferOwnership', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { inputs: [ { name: '_name', @@ -1901,13 +1813,12 @@ _symbol type: 'string', }, ], - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'constructor', }, - { + { anonymous: false, inputs: [ { @@ -1927,11 +1838,10 @@ _symbol }, ], name: 'Transfer', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1951,11 +1861,10 @@ _symbol }, ], name: 'Approval', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1975,8 +1884,7 @@ _symbol }, ], name: 'ApprovalForAll', - outputs: [ - ], + outputs: [], type: 'event', }, ] as ContractAbi; @@ -2050,15 +1958,27 @@ _symbol ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { - super('DummyERC721Token', DummyERC721TokenContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { + super( + 'DummyERC721Token', + DummyERC721TokenContract.ABI(), + address, + supportedProvider, + txDefaults, + logDecodeDependencies, + ); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( DummyERC721TokenContract.ABI(), this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 7f54073ecf..e7aa2434df 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts @@ -1,7 +1,7 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract,PromiseWithTransactionHash } from '@0x/base-contract'; +import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -23,91 +23,144 @@ import { assert } from '@0x/assert'; import * as ethers from 'ethers'; // tslint:enable:no-unused-variable - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class DutchAuctionContract extends BaseContract { public getAuctionDetails = { async sendTransactionAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - txData?: Partial | undefined, - ): Promise { - - const self = this as any as DutchAuctionContract; - const encodedData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; }, - self._web3Wrapper.getContractDefaults(), - self.getAuctionDetails.estimateGasAsync.bind( - self, - order - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + txData?: Partial | undefined, + ): Promise { + const self = (this as any) as DutchAuctionContract; + const encodedData = self._strictEncodeArguments( + 'getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', + [order], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.getAuctionDetails.estimateGasAsync.bind(self, order), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - - const self = this as any as DutchAuctionContract; - const txHashPromise = self.getAuctionDetails.sendTransactionAsync(order - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + const self = (this as any) as DutchAuctionContract; + const txHashPromise = self.getAuctionDetails.sendTransactionAsync(order, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, txData?: Partial | undefined, ): Promise { - - const self = this as any as DutchAuctionContract; - const encodedData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + const self = (this as any) as DutchAuctionContract; + const encodedData = self._strictEncodeArguments( + 'getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', + [order], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{beginTimeSeconds: BigNumber;endTimeSeconds: BigNumber;beginAmount: BigNumber;endAmount: BigNumber;currentAmount: BigNumber;currentTimeSeconds: BigNumber} - > { - + ): Promise<{ + beginTimeSeconds: BigNumber; + endTimeSeconds: BigNumber; + beginAmount: BigNumber; + endAmount: BigNumber; + currentAmount: BigNumber; + currentTimeSeconds: BigNumber; + }> { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -116,9 +169,11 @@ export class DutchAuctionContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DutchAuctionContract; - const encodedData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order - ]); + const self = (this as any) as DutchAuctionContract; + const encodedData = self._strictEncodeArguments( + 'getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', + [order], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -127,141 +182,266 @@ export class DutchAuctionContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))'); + const abiEncoder = self._lookupAbiEncoder( + 'getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{beginTimeSeconds: BigNumber;endTimeSeconds: BigNumber;beginAmount: BigNumber;endAmount: BigNumber;currentAmount: BigNumber;currentTimeSeconds: BigNumber} - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{ + beginTimeSeconds: BigNumber; + endTimeSeconds: BigNumber; + beginAmount: BigNumber; + endAmount: BigNumber; + currentAmount: BigNumber; + currentTimeSeconds: BigNumber; + }>(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - ): string { - - const self = this as any as DutchAuctionContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order - ]); + getABIEncodedTransactionData(order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }): string { + const self = (this as any) as DutchAuctionContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', + [order], + ); return abiEncodedTransactionData; }, }; public matchOrders = { async sendTransactionAsync( - buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + buyOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, + sellOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, buySignature: string, sellSignature: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - - - assert.isString('buySignature', buySignature); - assert.isString('sellSignature', sellSignature); - const self = this as any as DutchAuctionContract; - const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [buyOrder, - sellOrder, - buySignature, - sellSignature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.matchOrders.estimateGasAsync.bind( - self, - buyOrder, - sellOrder, - buySignature, - sellSignature - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isString('buySignature', buySignature); + assert.isString('sellSignature', sellSignature); + const self = (this as any) as DutchAuctionContract; + const encodedData = self._strictEncodeArguments( + 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', + [buyOrder, sellOrder, buySignature, sellSignature], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.matchOrders.estimateGasAsync.bind(self, buyOrder, sellOrder, buySignature, sellSignature), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + buyOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, + sellOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, buySignature: string, sellSignature: string, txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - - - assert.isString('buySignature', buySignature); - assert.isString('sellSignature', sellSignature); - const self = this as any as DutchAuctionContract; - const txHashPromise = self.matchOrders.sendTransactionAsync(buyOrder, - sellOrder, - buySignature, - sellSignature - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('buySignature', buySignature); + assert.isString('sellSignature', sellSignature); + const self = (this as any) as DutchAuctionContract; + const txHashPromise = self.matchOrders.sendTransactionAsync( + buyOrder, + sellOrder, + buySignature, + sellSignature, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + buyOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, + sellOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, buySignature: string, sellSignature: string, txData?: Partial | undefined, ): Promise { - - - assert.isString('buySignature', buySignature); - assert.isString('sellSignature', sellSignature); - const self = this as any as DutchAuctionContract; - const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [buyOrder, - sellOrder, - buySignature, - sellSignature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('buySignature', buySignature); + assert.isString('sellSignature', sellSignature); + const self = (this as any) as DutchAuctionContract; + const encodedData = self._strictEncodeArguments( + 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', + [buyOrder, sellOrder, buySignature, sellSignature], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + buyOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, + sellOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, buySignature: string, sellSignature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber} - > { - - + ): Promise<{ + left: { + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }; + right: { + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }; + leftMakerAssetSpreadAmount: BigNumber; + }> { assert.isString('buySignature', buySignature); assert.isString('sellSignature', sellSignature); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -272,12 +452,11 @@ export class DutchAuctionContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as DutchAuctionContract; - const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [buyOrder, - sellOrder, - buySignature, - sellSignature - ]); + const self = (this as any) as DutchAuctionContract; + const encodedData = self._strictEncodeArguments( + 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', + [buyOrder, sellOrder, buySignature, sellSignature], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -286,42 +465,82 @@ export class DutchAuctionContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(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)'); + const abiEncoder = self._lookupAbiEncoder( + 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber} - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{ + left: { + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }; + right: { + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }; + leftMakerAssetSpreadAmount: BigNumber; + }>(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - buySignature: string, - sellSignature: string, - ): string { - - + buyOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, + sellOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, + buySignature: string, + sellSignature: string, + ): string { assert.isString('buySignature', buySignature); assert.isString('sellSignature', sellSignature); - const self = this as any as DutchAuctionContract; - const abiEncodedTransactionData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [buyOrder, - sellOrder, - buySignature, - sellSignature - ]); + const self = (this as any) as DutchAuctionContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', + [buyOrder, sellOrder, buySignature, sellSignature], + ); return abiEncodedTransactionData; }, }; -public static async deployFrom0xArtifactAsync( + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, - _exchange: string, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + _exchange: string, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -334,9 +553,18 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); - return DutchAuctionContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, _exchange -); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, + ); + return DutchAuctionContract.deployAsync( + bytecode, + abi, + provider, + txDefaults, + logDecodeDependenciesAbiOnly, + _exchange, + ); } public static async deployAsync( bytecode: string, @@ -344,7 +572,7 @@ public static async deployFrom0xArtifactAsync( supportedProvider: SupportedProvider, txDefaults: Partial, logDecodeDependencies: { [contractName: string]: ContractAbi }, - _exchange: string, + _exchange: string, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -354,20 +582,17 @@ public static async deployFrom0xArtifactAsync( ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_exchange -] = BaseContract._formatABIDataItemList( + [_exchange] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [_exchange -], + [_exchange], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_exchange -]); + const txData = deployInfo.encode(bytecode, [_exchange]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -375,19 +600,22 @@ public static async deployFrom0xArtifactAsync( logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`DutchAuction successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new DutchAuctionContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); - contractInstance.constructorArgs = [_exchange -]; + const contractInstance = new DutchAuctionContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + logDecodeDependencies, + ); + contractInstance.constructorArgs = [_exchange]; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: false, inputs: [ { @@ -442,7 +670,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, ], name: 'getAuctionDetails', @@ -475,14 +703,14 @@ public static async deployFrom0xArtifactAsync( name: 'currentTimeSeconds', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -537,7 +765,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'sellOrder', @@ -591,7 +819,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'buySignature', @@ -628,7 +856,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, { name: 'right', @@ -650,28 +878,27 @@ public static async deployFrom0xArtifactAsync( name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, { name: 'leftMakerAssetSpreadAmount', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { inputs: [ { name: '_exchange', type: 'address', }, ], - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'constructor', @@ -679,11 +906,23 @@ public static async deployFrom0xArtifactAsync( ] as ContractAbi; return abi; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { - super('DutchAuction', DutchAuctionContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { + super( + 'DutchAuction', + DutchAuctionContract.ABI(), + address, + supportedProvider, + txDefaults, + logDecodeDependencies, + ); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 e1807954be..bcfd2f5b1c 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts @@ -1,11 +1,14 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, +import { + BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; + SubscriptionManager, + PromiseWithTransactionHash, +} from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -47,38 +50,30 @@ export interface ERC20ProxyAuthorizedAddressRemovedEventArgs extends DecodedLogA caller: string; } - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class ERC20ProxyContract extends BaseContract { public addAuthorizedAddress = { - async sendTransactionAsync( - target: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('target', target); - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.addAuthorizedAddress.estimateGasAsync.bind( - self, - target.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.addAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -86,51 +81,41 @@ export class ERC20ProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = this as any as ERC20ProxyContract; - const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + const self = (this as any) as ERC20ProxyContract; + const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - target: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('target', target); - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - target: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('target', target); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -140,9 +125,8 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() - ]); + const self = (this as any) as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -151,24 +135,24 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - target: string, - ): string { + getABIEncodedTransactionData(target: string): string { assert.isString('target', target); - const self = this as any as ERC20ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() - ]); + const self = (this as any) as ERC20ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [ + target.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; @@ -177,8 +161,7 @@ export class ERC20ProxyContract extends BaseContract { index_0: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -188,9 +171,8 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0 - ]); + const self = (this as any) as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -199,54 +181,45 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: BigNumber, - ): string { + getABIEncodedTransactionData(index_0: BigNumber): string { assert.isBigNumber('index_0', index_0); - const self = this as any as ERC20ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('authorities(uint256)', [index_0 - ]); + const self = (this as any) as ERC20ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('authorities(uint256)', [index_0]); return abiEncodedTransactionData; }, }; public removeAuthorizedAddress = { - async sendTransactionAsync( - target: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('target', target); - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddress.estimateGasAsync.bind( - self, - target.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -254,51 +227,41 @@ export class ERC20ProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = this as any as ERC20ProxyContract; - const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + const self = (this as any) as ERC20ProxyContract; + const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - target: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('target', target); - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - target: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('target', target); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -308,9 +271,8 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() - ]); + const self = (this as any) as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -319,33 +281,29 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - target: string, - ): string { + getABIEncodedTransactionData(target: string): string { assert.isString('target', target); - const self = this as any as ERC20ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() - ]); + const self = (this as any) as ERC20ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [ + target.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public owner = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -354,7 +312,7 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC20ProxyContract; + const self = (this as any) as ERC20ProxyContract; const encodedData = self._strictEncodeArguments('owner()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -364,20 +322,20 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as ERC20ProxyContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as ERC20ProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); return abiEncodedTransactionData; }, @@ -386,33 +344,30 @@ export class ERC20ProxyContract extends BaseContract { async sendTransactionAsync( target: string, index: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), - index - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind( - self, + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ target.toLowerCase(), - index - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + index, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(self, target.toLowerCase(), index), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -421,57 +376,59 @@ export class ERC20ProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = this as any as ERC20ProxyContract; - const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync(target.toLowerCase(), - index - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as ERC20ProxyContract; + const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync( + target.toLowerCase(), + index, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( target: string, index: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), - index - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ + target.toLowerCase(), + index, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( target: string, index: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('target', target); assert.isBigNumber('index', index); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -482,10 +439,11 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), - index - ]); + const self = (this as any) as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ + target.toLowerCase(), + index, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -494,36 +452,31 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - target: string, - index: BigNumber, - ): string { + getABIEncodedTransactionData(target: string, index: BigNumber): string { assert.isString('target', target); assert.isBigNumber('index', index); - const self = this as any as ERC20ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), - index - ]); + const self = (this as any) as ERC20ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'removeAuthorizedAddressAtIndex(address,uint256)', + [target.toLowerCase(), index], + ); return abiEncodedTransactionData; }, }; public getProxyId = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -532,7 +485,7 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC20ProxyContract; + const self = (this as any) as ERC20ProxyContract; const encodedData = self._strictEncodeArguments('getProxyId()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -542,20 +495,20 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getProxyId()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as ERC20ProxyContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as ERC20ProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('getProxyId()', []); return abiEncodedTransactionData; }, @@ -565,8 +518,7 @@ export class ERC20ProxyContract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -576,9 +528,8 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase() - ]); + const self = (this as any) as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -587,33 +538,29 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorized(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: string, - ): string { + getABIEncodedTransactionData(index_0: string): string { assert.isString('index_0', index_0); - const self = this as any as ERC20ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase() - ]); + const self = (this as any) as ERC20ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [ + index_0.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public getAuthorizedAddresses = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -622,7 +569,7 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC20ProxyContract; + const self = (this as any) as ERC20ProxyContract; const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -632,51 +579,44 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as ERC20ProxyContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as ERC20ProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('getAuthorizedAddresses()', []); return abiEncodedTransactionData; }, }; public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('newOwner', newOwner); - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind( - self, - newOwner.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( newOwner: string, @@ -684,51 +624,41 @@ export class ERC20ProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('newOwner', newOwner); - const self = this as any as ERC20ProxyContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('newOwner', newOwner); + const self = (this as any) as ERC20ProxyContract; + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - newOwner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('newOwner', newOwner); - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - newOwner: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -738,9 +668,8 @@ export class ERC20ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); + const self = (this as any) as ERC20ProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -749,33 +678,33 @@ export class ERC20ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - newOwner: string, - ): string { + getABIEncodedTransactionData(newOwner: string): string { assert.isString('newOwner', newOwner); - const self = this as any as ERC20ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); + const self = (this as any) as ERC20ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ + newOwner.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; -private readonly _subscriptionManager: SubscriptionManager; -public static async deployFrom0xArtifactAsync( + private readonly _subscriptionManager: SubscriptionManager; + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -788,8 +717,11 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); - return ERC20ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, + ); + return ERC20ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( bytecode: string, @@ -806,17 +738,13 @@ public static async deployFrom0xArtifactAsync( ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); + [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -824,18 +752,22 @@ public static async deployFrom0xArtifactAsync( logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`ERC20Proxy successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ERC20ProxyContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); + const contractInstance = new ERC20ProxyContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + logDecodeDependencies, + ); contractInstance.constructorArgs = []; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: false, inputs: [ { @@ -844,13 +776,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'addAuthorizedAddress', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -869,7 +800,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -878,16 +809,14 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'removeAuthorizedAddress', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'owner', outputs: [ { @@ -899,7 +828,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -912,16 +841,14 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'removeAuthorizedAddressAtIndex', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'getProxyId', outputs: [ { @@ -933,7 +860,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'pure', type: 'function', }, - { + { constant: true, inputs: [ { @@ -952,10 +879,9 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'getAuthorizedAddresses', outputs: [ { @@ -967,7 +893,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -976,22 +902,19 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'transferOwnership', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { - inputs: [ - ], - outputs: [ - ], + { + inputs: [], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'fallback', }, - { + { anonymous: false, inputs: [ { @@ -1006,11 +929,10 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'AuthorizedAddressAdded', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1025,8 +947,7 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'AuthorizedAddressRemoved', - outputs: [ - ], + outputs: [], type: 'event', }, ] as ContractAbi; @@ -1100,7 +1021,12 @@ public static async deployFrom0xArtifactAsync( ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { super('ERC20Proxy', ERC20ProxyContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( @@ -1108,7 +1034,7 @@ public static async deployFrom0xArtifactAsync( this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 5599c751f4..58b2815bc4 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts @@ -1,11 +1,14 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, +import { + BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; + SubscriptionManager, + PromiseWithTransactionHash, +} from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -28,9 +31,7 @@ import { assert } from '@0x/assert'; import * as ethers from 'ethers'; // tslint:enable:no-unused-variable -export type ERC20TokenEventArgs = - | ERC20TokenTransferEventArgs - | ERC20TokenApprovalEventArgs; +export type ERC20TokenEventArgs = ERC20TokenTransferEventArgs | ERC20TokenApprovalEventArgs; export enum ERC20TokenEvents { Transfer = 'Transfer', @@ -49,7 +50,6 @@ export interface ERC20TokenApprovalEventArgs extends DecodedLogArgs { _value: BigNumber; } - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name @@ -58,33 +58,30 @@ export class ERC20TokenContract extends BaseContract { async sendTransactionAsync( _spender: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = this as any as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind( - self, + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = (this as any) as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ _spender.toLowerCase(), - _value - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _value, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.approve.estimateGasAsync.bind(self, _spender.toLowerCase(), _value), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _spender: string, @@ -93,57 +90,55 @@ export class ERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = this as any as ERC20TokenContract; - const txHashPromise = self.approve.sendTransactionAsync(_spender.toLowerCase(), - _value - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = (this as any) as ERC20TokenContract; + const txHashPromise = self.approve.sendTransactionAsync(_spender.toLowerCase(), _value, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _spender: string, _value: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = this as any as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = (this as any) as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + _spender.toLowerCase(), + _value, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _spender: string, _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -154,10 +149,11 @@ export class ERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), - _value - ]); + const self = (this as any) as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + _spender.toLowerCase(), + _value, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -166,36 +162,31 @@ export class ERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _spender: string, - _value: BigNumber, - ): string { + getABIEncodedTransactionData(_spender: string, _value: BigNumber): string { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); - const self = this as any as ERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), - _value - ]); + const self = (this as any) as ERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [ + _spender.toLowerCase(), + _value, + ]); return abiEncodedTransactionData; }, }; public totalSupply = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -204,7 +195,7 @@ export class ERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC20TokenContract; + const self = (this as any) as ERC20TokenContract; const encodedData = self._strictEncodeArguments('totalSupply()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -214,20 +205,20 @@ export class ERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('totalSupply()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as ERC20TokenContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as ERC20TokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('totalSupply()', []); return abiEncodedTransactionData; }, @@ -237,36 +228,32 @@ export class ERC20TokenContract extends BaseContract { _from: string, _to: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind( - self, + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ _from.toLowerCase(), _to.toLowerCase(), - _value - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _value, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferFrom.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _value), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -276,25 +263,27 @@ export class ERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as ERC20TokenContract; - const txHashPromise = self.transferFrom.sendTransactionAsync(_from.toLowerCase(), - _to.toLowerCase(), - _value - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as ERC20TokenContract; + const txHashPromise = self.transferFrom.sendTransactionAsync( + _from.toLowerCase(), + _to.toLowerCase(), + _value, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -302,28 +291,29 @@ export class ERC20TokenContract extends BaseContract { _value: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _value, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -331,8 +321,7 @@ export class ERC20TokenContract extends BaseContract { _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_value', _value); @@ -344,11 +333,12 @@ export class ERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _value - ]); + const self = (this as any) as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _value, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -357,30 +347,28 @@ export class ERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _value: BigNumber, - ): string { + getABIEncodedTransactionData(_from: string, _to: string, _value: BigNumber): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_value', _value); - const self = this as any as ERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _value - ]); + const self = (this as any) as ERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _value, + ]); return abiEncodedTransactionData; }, }; @@ -389,8 +377,7 @@ export class ERC20TokenContract extends BaseContract { _owner: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -400,9 +387,8 @@ export class ERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() - ]); + const self = (this as any) as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -411,24 +397,22 @@ export class ERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _owner: string, - ): string { + getABIEncodedTransactionData(_owner: string): string { assert.isString('_owner', _owner); - const self = this as any as ERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() - ]); + const self = (this as any) as ERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); return abiEncodedTransactionData; }, }; @@ -436,33 +420,27 @@ export class ERC20TokenContract extends BaseContract { async sendTransactionAsync( _to: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transfer.estimateGasAsync.bind( - self, - _to.toLowerCase(), - _value - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transfer.estimateGasAsync.bind(self, _to.toLowerCase(), _value), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _to: string, @@ -471,57 +449,48 @@ export class ERC20TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as ERC20TokenContract; - const txHashPromise = self.transfer.sendTransactionAsync(_to.toLowerCase(), - _value - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as ERC20TokenContract; + const txHashPromise = self.transfer.sendTransactionAsync(_to.toLowerCase(), _value, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - _to: string, - _value: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(_to: string, _value: BigNumber, txData?: Partial | undefined): Promise { + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _to: string, _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_to', _to); assert.isBigNumber('_value', _value); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -532,10 +501,8 @@ export class ERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), - _value - ]); + const self = (this as any) as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -544,27 +511,26 @@ export class ERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _to: string, - _value: BigNumber, - ): string { + getABIEncodedTransactionData(_to: string, _value: BigNumber): string { assert.isString('_to', _to); assert.isBigNumber('_value', _value); - const self = this as any as ERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), - _value - ]); + const self = (this as any) as ERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [ + _to.toLowerCase(), + _value, + ]); return abiEncodedTransactionData; }, }; @@ -574,8 +540,7 @@ export class ERC20TokenContract extends BaseContract { _spender: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.isString('_spender', _spender); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -586,10 +551,11 @@ export class ERC20TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('allowance(address,address)', [_owner.toLowerCase(), - _spender.toLowerCase() - ]); + const self = (this as any) as ERC20TokenContract; + const encodedData = self._strictEncodeArguments('allowance(address,address)', [ + _owner.toLowerCase(), + _spender.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -598,36 +564,35 @@ export class ERC20TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _owner: string, - _spender: string, - ): string { + getABIEncodedTransactionData(_owner: string, _spender: string): string { assert.isString('_owner', _owner); assert.isString('_spender', _spender); - const self = this as any as ERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [_owner.toLowerCase(), - _spender.toLowerCase() - ]); + const self = (this as any) as ERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [ + _owner.toLowerCase(), + _spender.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; -private readonly _subscriptionManager: SubscriptionManager; -public static async deployFrom0xArtifactAsync( + private readonly _subscriptionManager: SubscriptionManager; + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -640,8 +605,11 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); - return ERC20TokenContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, + ); + return ERC20TokenContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( bytecode: string, @@ -658,17 +626,13 @@ public static async deployFrom0xArtifactAsync( ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); + [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -676,18 +640,22 @@ public static async deployFrom0xArtifactAsync( logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`ERC20Token successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ERC20TokenContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); + const contractInstance = new ERC20TokenContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + logDecodeDependencies, + ); contractInstance.constructorArgs = []; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: false, inputs: [ { @@ -710,10 +678,9 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'totalSupply', outputs: [ { @@ -725,7 +692,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -752,7 +719,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -771,7 +738,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -794,7 +761,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -817,7 +784,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { anonymous: false, inputs: [ { @@ -837,11 +804,10 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'Transfer', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -861,8 +827,7 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'Approval', - outputs: [ - ], + outputs: [], type: 'event', }, ] as ContractAbi; @@ -936,7 +901,12 @@ public static async deployFrom0xArtifactAsync( ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { super('ERC20Token', ERC20TokenContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( @@ -944,7 +914,7 @@ public static async deployFrom0xArtifactAsync( this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 829d8b8469..ee5085d4ab 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts @@ -1,11 +1,14 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, +import { + BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; + SubscriptionManager, + PromiseWithTransactionHash, +} from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -47,38 +50,30 @@ export interface ERC721ProxyAuthorizedAddressRemovedEventArgs extends DecodedLog caller: string; } - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class ERC721ProxyContract extends BaseContract { public addAuthorizedAddress = { - async sendTransactionAsync( - target: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('target', target); - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.addAuthorizedAddress.estimateGasAsync.bind( - self, - target.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.addAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -86,51 +81,41 @@ export class ERC721ProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = this as any as ERC721ProxyContract; - const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + const self = (this as any) as ERC721ProxyContract; + const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - target: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('target', target); - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - target: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('target', target); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -140,9 +125,8 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() - ]); + const self = (this as any) as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -151,24 +135,24 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - target: string, - ): string { + getABIEncodedTransactionData(target: string): string { assert.isString('target', target); - const self = this as any as ERC721ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() - ]); + const self = (this as any) as ERC721ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [ + target.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; @@ -177,8 +161,7 @@ export class ERC721ProxyContract extends BaseContract { index_0: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -188,9 +171,8 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0 - ]); + const self = (this as any) as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -199,54 +181,45 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: BigNumber, - ): string { + getABIEncodedTransactionData(index_0: BigNumber): string { assert.isBigNumber('index_0', index_0); - const self = this as any as ERC721ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('authorities(uint256)', [index_0 - ]); + const self = (this as any) as ERC721ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('authorities(uint256)', [index_0]); return abiEncodedTransactionData; }, }; public removeAuthorizedAddress = { - async sendTransactionAsync( - target: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('target', target); - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddress.estimateGasAsync.bind( - self, - target.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -254,51 +227,41 @@ export class ERC721ProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = this as any as ERC721ProxyContract; - const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + const self = (this as any) as ERC721ProxyContract; + const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - target: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('target', target); - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - target: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('target', target); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -308,9 +271,8 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() - ]); + const self = (this as any) as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -319,33 +281,29 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - target: string, - ): string { + getABIEncodedTransactionData(target: string): string { assert.isString('target', target); - const self = this as any as ERC721ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() - ]); + const self = (this as any) as ERC721ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [ + target.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public owner = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -354,7 +312,7 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721ProxyContract; + const self = (this as any) as ERC721ProxyContract; const encodedData = self._strictEncodeArguments('owner()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -364,20 +322,20 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as ERC721ProxyContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as ERC721ProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); return abiEncodedTransactionData; }, @@ -386,33 +344,30 @@ export class ERC721ProxyContract extends BaseContract { async sendTransactionAsync( target: string, index: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), - index - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind( - self, + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ target.toLowerCase(), - index - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + index, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(self, target.toLowerCase(), index), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -421,57 +376,59 @@ export class ERC721ProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = this as any as ERC721ProxyContract; - const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync(target.toLowerCase(), - index - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as ERC721ProxyContract; + const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync( + target.toLowerCase(), + index, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( target: string, index: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), - index - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ + target.toLowerCase(), + index, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( target: string, index: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('target', target); assert.isBigNumber('index', index); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -482,10 +439,11 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), - index - ]); + const self = (this as any) as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ + target.toLowerCase(), + index, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -494,36 +452,31 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - target: string, - index: BigNumber, - ): string { + getABIEncodedTransactionData(target: string, index: BigNumber): string { assert.isString('target', target); assert.isBigNumber('index', index); - const self = this as any as ERC721ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), - index - ]); + const self = (this as any) as ERC721ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'removeAuthorizedAddressAtIndex(address,uint256)', + [target.toLowerCase(), index], + ); return abiEncodedTransactionData; }, }; public getProxyId = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -532,7 +485,7 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721ProxyContract; + const self = (this as any) as ERC721ProxyContract; const encodedData = self._strictEncodeArguments('getProxyId()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -542,20 +495,20 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getProxyId()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as ERC721ProxyContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as ERC721ProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('getProxyId()', []); return abiEncodedTransactionData; }, @@ -565,8 +518,7 @@ export class ERC721ProxyContract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -576,9 +528,8 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase() - ]); + const self = (this as any) as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -587,33 +538,29 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorized(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: string, - ): string { + getABIEncodedTransactionData(index_0: string): string { assert.isString('index_0', index_0); - const self = this as any as ERC721ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase() - ]); + const self = (this as any) as ERC721ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [ + index_0.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public getAuthorizedAddresses = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -622,7 +569,7 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721ProxyContract; + const self = (this as any) as ERC721ProxyContract; const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -632,51 +579,44 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as ERC721ProxyContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as ERC721ProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('getAuthorizedAddresses()', []); return abiEncodedTransactionData; }, }; public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('newOwner', newOwner); - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind( - self, - newOwner.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( newOwner: string, @@ -684,51 +624,41 @@ export class ERC721ProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('newOwner', newOwner); - const self = this as any as ERC721ProxyContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('newOwner', newOwner); + const self = (this as any) as ERC721ProxyContract; + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - newOwner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('newOwner', newOwner); - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - newOwner: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -738,9 +668,8 @@ export class ERC721ProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); + const self = (this as any) as ERC721ProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -749,33 +678,33 @@ export class ERC721ProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - newOwner: string, - ): string { + getABIEncodedTransactionData(newOwner: string): string { assert.isString('newOwner', newOwner); - const self = this as any as ERC721ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); + const self = (this as any) as ERC721ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ + newOwner.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; -private readonly _subscriptionManager: SubscriptionManager; -public static async deployFrom0xArtifactAsync( + private readonly _subscriptionManager: SubscriptionManager; + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -788,8 +717,11 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); - return ERC721ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, + ); + return ERC721ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( bytecode: string, @@ -806,17 +738,13 @@ public static async deployFrom0xArtifactAsync( ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); + [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -824,18 +752,22 @@ public static async deployFrom0xArtifactAsync( logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`ERC721Proxy successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ERC721ProxyContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); + const contractInstance = new ERC721ProxyContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + logDecodeDependencies, + ); contractInstance.constructorArgs = []; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: false, inputs: [ { @@ -844,13 +776,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'addAuthorizedAddress', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -869,7 +800,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -878,16 +809,14 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'removeAuthorizedAddress', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'owner', outputs: [ { @@ -899,7 +828,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -912,16 +841,14 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'removeAuthorizedAddressAtIndex', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'getProxyId', outputs: [ { @@ -933,7 +860,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'pure', type: 'function', }, - { + { constant: true, inputs: [ { @@ -952,10 +879,9 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'getAuthorizedAddresses', outputs: [ { @@ -967,7 +893,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -976,22 +902,19 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'transferOwnership', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { - inputs: [ - ], - outputs: [ - ], + { + inputs: [], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'fallback', }, - { + { anonymous: false, inputs: [ { @@ -1006,11 +929,10 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'AuthorizedAddressAdded', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1025,8 +947,7 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'AuthorizedAddressRemoved', - outputs: [ - ], + outputs: [], type: 'event', }, ] as ContractAbi; @@ -1100,7 +1021,12 @@ public static async deployFrom0xArtifactAsync( ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { super('ERC721Proxy', ERC721ProxyContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( @@ -1108,7 +1034,7 @@ public static async deployFrom0xArtifactAsync( this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 fe4a3ebfac..2a0420e010 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts @@ -1,11 +1,14 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, +import { + BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; + SubscriptionManager, + PromiseWithTransactionHash, +} from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -57,7 +60,6 @@ export interface ERC721TokenApprovalForAllEventArgs extends DecodedLogArgs { _approved: boolean; } - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name @@ -67,8 +69,7 @@ export class ERC721TokenContract extends BaseContract { _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('_tokenId', _tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -78,9 +79,8 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId - ]); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -89,24 +89,22 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getApproved(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _tokenId: BigNumber, - ): string { + getABIEncodedTransactionData(_tokenId: BigNumber): string { assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId - ]); + const self = (this as any) as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId]); return abiEncodedTransactionData; }, }; @@ -114,33 +112,30 @@ export class ERC721TokenContract extends BaseContract { async sendTransactionAsync( _approved: string, _tokenId: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_approved', _approved); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(), - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind( - self, + assert.isString('_approved', _approved); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ _approved.toLowerCase(), - _tokenId - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _tokenId, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.approve.estimateGasAsync.bind(self, _approved.toLowerCase(), _tokenId), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _approved: string, @@ -149,57 +144,55 @@ export class ERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_approved', _approved); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as ERC721TokenContract; - const txHashPromise = self.approve.sendTransactionAsync(_approved.toLowerCase(), - _tokenId - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_approved', _approved); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as ERC721TokenContract; + const txHashPromise = self.approve.sendTransactionAsync(_approved.toLowerCase(), _tokenId, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _approved: string, _tokenId: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_approved', _approved); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(), - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_approved', _approved); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + _approved.toLowerCase(), + _tokenId, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _approved: string, _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_approved', _approved); assert.isBigNumber('_tokenId', _tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -210,10 +203,11 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(), - _tokenId - ]); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + _approved.toLowerCase(), + _tokenId, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -222,27 +216,26 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _approved: string, - _tokenId: BigNumber, - ): string { + getABIEncodedTransactionData(_approved: string, _tokenId: BigNumber): string { assert.isString('_approved', _approved); assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_approved.toLowerCase(), - _tokenId - ]); + const self = (this as any) as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [ + _approved.toLowerCase(), + _tokenId, + ]); return abiEncodedTransactionData; }, }; @@ -251,36 +244,32 @@ export class ERC721TokenContract extends BaseContract { _from: string, _to: string, _tokenId: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind( - self, + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ _from.toLowerCase(), _to.toLowerCase(), - _tokenId - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _tokenId, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferFrom.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _tokenId), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -290,25 +279,27 @@ export class ERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as ERC721TokenContract; - const txHashPromise = self.transferFrom.sendTransactionAsync(_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as ERC721TokenContract; + const txHashPromise = self.transferFrom.sendTransactionAsync( + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -316,28 +307,29 @@ export class ERC721TokenContract extends BaseContract { _tokenId: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -345,8 +337,7 @@ export class ERC721TokenContract extends BaseContract { _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); @@ -358,11 +349,12 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - ]); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -371,30 +363,28 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _tokenId: BigNumber, - ): string { + getABIEncodedTransactionData(_from: string, _to: string, _tokenId: BigNumber): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - ]); + const self = (this as any) as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + ]); return abiEncodedTransactionData; }, }; @@ -403,36 +393,32 @@ export class ERC721TokenContract extends BaseContract { _from: string, _to: string, _tokenId: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.safeTransferFrom1.estimateGasAsync.bind( - self, + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ _from.toLowerCase(), _to.toLowerCase(), - _tokenId - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _tokenId, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.safeTransferFrom1.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _tokenId), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -442,25 +428,27 @@ export class ERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as ERC721TokenContract; - const txHashPromise = self.safeTransferFrom1.sendTransactionAsync(_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as ERC721TokenContract; + const txHashPromise = self.safeTransferFrom1.sendTransactionAsync( + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -468,28 +456,29 @@ export class ERC721TokenContract extends BaseContract { _tokenId: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -497,8 +486,7 @@ export class ERC721TokenContract extends BaseContract { _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); @@ -510,11 +498,12 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - ]); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -523,30 +512,28 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _tokenId: BigNumber, - ): string { + getABIEncodedTransactionData(_from: string, _to: string, _tokenId: BigNumber): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId - ]); + const self = (this as any) as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + ]); return abiEncodedTransactionData; }, }; @@ -555,8 +542,7 @@ export class ERC721TokenContract extends BaseContract { _tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('_tokenId', _tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -566,9 +552,8 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId - ]); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -577,24 +562,22 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('ownerOf(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _tokenId: BigNumber, - ): string { + getABIEncodedTransactionData(_tokenId: BigNumber): string { assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId - ]); + const self = (this as any) as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId]); return abiEncodedTransactionData; }, }; @@ -603,8 +586,7 @@ export class ERC721TokenContract extends BaseContract { _owner: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -614,9 +596,8 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() - ]); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -625,24 +606,22 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _owner: string, - ): string { + getABIEncodedTransactionData(_owner: string): string { assert.isString('_owner', _owner); - const self = this as any as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() - ]); + const self = (this as any) as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); return abiEncodedTransactionData; }, }; @@ -650,33 +629,30 @@ export class ERC721TokenContract extends BaseContract { async sendTransactionAsync( _operator: string, _approved: boolean, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_operator', _operator); - assert.isBoolean('_approved', _approved); - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(), - _approved - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.setApprovalForAll.estimateGasAsync.bind( - self, + assert.isString('_operator', _operator); + assert.isBoolean('_approved', _approved); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ _operator.toLowerCase(), - _approved - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _approved, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.setApprovalForAll.estimateGasAsync.bind(self, _operator.toLowerCase(), _approved), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _operator: string, @@ -685,57 +661,59 @@ export class ERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_operator', _operator); - assert.isBoolean('_approved', _approved); - const self = this as any as ERC721TokenContract; - const txHashPromise = self.setApprovalForAll.sendTransactionAsync(_operator.toLowerCase(), - _approved - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_operator', _operator); + assert.isBoolean('_approved', _approved); + const self = (this as any) as ERC721TokenContract; + const txHashPromise = self.setApprovalForAll.sendTransactionAsync( + _operator.toLowerCase(), + _approved, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _operator: string, _approved: boolean, txData?: Partial | undefined, ): Promise { - assert.isString('_operator', _operator); - assert.isBoolean('_approved', _approved); - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(), - _approved - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_operator', _operator); + assert.isBoolean('_approved', _approved); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ + _operator.toLowerCase(), + _approved, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _operator: string, _approved: boolean, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_operator', _operator); assert.isBoolean('_approved', _approved); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -746,10 +724,11 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(), - _approved - ]); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ + _operator.toLowerCase(), + _approved, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -758,27 +737,26 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _operator: string, - _approved: boolean, - ): string { + getABIEncodedTransactionData(_operator: string, _approved: boolean): string { assert.isString('_operator', _operator); assert.isBoolean('_approved', _approved); - const self = this as any as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator.toLowerCase(), - _approved - ]); + const self = (this as any) as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [ + _operator.toLowerCase(), + _approved, + ]); return abiEncodedTransactionData; }, }; @@ -788,39 +766,40 @@ export class ERC721TokenContract extends BaseContract { _to: string, _tokenId: BigNumber, _data: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - assert.isString('_data', _data); - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.safeTransferFrom2.estimateGasAsync.bind( - self, + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + assert.isString('_data', _data); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [ _from.toLowerCase(), _to.toLowerCase(), _tokenId, - _data - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _data, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.safeTransferFrom2.estimateGasAsync.bind( + self, + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data, + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -831,27 +810,29 @@ export class ERC721TokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - assert.isString('_data', _data); - const self = this as any as ERC721TokenContract; - const txHashPromise = self.safeTransferFrom2.sendTransactionAsync(_from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + assert.isString('_data', _data); + const self = (this as any) as ERC721TokenContract; + const txHashPromise = self.safeTransferFrom2.sendTransactionAsync( + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -860,30 +841,31 @@ export class ERC721TokenContract extends BaseContract { _data: string, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - assert.isString('_data', _data); - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + assert.isString('_data', _data); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -892,8 +874,7 @@ export class ERC721TokenContract extends BaseContract { _data: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); @@ -906,12 +887,13 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data - ]); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _tokenId, + _data, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -920,33 +902,28 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _tokenId: BigNumber, - _data: string, - ): string { + getABIEncodedTransactionData(_from: string, _to: string, _tokenId: BigNumber, _data: string): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); assert.isString('_data', _data); - const self = this as any as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data - ]); + const self = (this as any) as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'safeTransferFrom(address,address,uint256,bytes)', + [_from.toLowerCase(), _to.toLowerCase(), _tokenId, _data], + ); return abiEncodedTransactionData; }, }; @@ -956,8 +933,7 @@ export class ERC721TokenContract extends BaseContract { _operator: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.isString('_operator', _operator); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -968,10 +944,11 @@ export class ERC721TokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('isApprovedForAll(address,address)', [_owner.toLowerCase(), - _operator.toLowerCase() - ]); + const self = (this as any) as ERC721TokenContract; + const encodedData = self._strictEncodeArguments('isApprovedForAll(address,address)', [ + _owner.toLowerCase(), + _operator.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -980,36 +957,35 @@ export class ERC721TokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isApprovedForAll(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _owner: string, - _operator: string, - ): string { + getABIEncodedTransactionData(_owner: string, _operator: string): string { assert.isString('_owner', _owner); assert.isString('_operator', _operator); - const self = this as any as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('isApprovedForAll(address,address)', [_owner.toLowerCase(), - _operator.toLowerCase() - ]); + const self = (this as any) as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isApprovedForAll(address,address)', [ + _owner.toLowerCase(), + _operator.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; -private readonly _subscriptionManager: SubscriptionManager; -public static async deployFrom0xArtifactAsync( + private readonly _subscriptionManager: SubscriptionManager; + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -1022,8 +998,11 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); - return ERC721TokenContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, + ); + return ERC721TokenContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( bytecode: string, @@ -1040,17 +1019,13 @@ public static async deployFrom0xArtifactAsync( ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); + [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -1058,18 +1033,22 @@ public static async deployFrom0xArtifactAsync( logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`ERC721Token successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ERC721TokenContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); + const contractInstance = new ERC721TokenContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + logDecodeDependencies, + ); contractInstance.constructorArgs = []; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -1088,7 +1067,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1101,13 +1080,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'approve', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1124,13 +1102,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'transferFrom', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1147,13 +1124,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'safeTransferFrom', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1172,7 +1148,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1191,7 +1167,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1204,13 +1180,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'setApprovalForAll', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1231,13 +1206,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'safeTransferFrom', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1260,7 +1234,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { anonymous: false, inputs: [ { @@ -1280,11 +1254,10 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'Transfer', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1304,11 +1277,10 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'Approval', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1328,8 +1300,7 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'ApprovalForAll', - outputs: [ - ], + outputs: [], type: 'event', }, ] as ContractAbi; @@ -1403,7 +1374,12 @@ public static async deployFrom0xArtifactAsync( ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { super('ERC721Token', ERC721TokenContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( @@ -1411,7 +1387,7 @@ public static async deployFrom0xArtifactAsync( this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 bc77e5c9b0..e4a6c2ac39 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 @@ -1,7 +1,7 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract,PromiseWithTransactionHash } from '@0x/base-contract'; +import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -23,7 +23,6 @@ import { assert } from '@0x/assert'; import * as ethers from 'ethers'; // tslint:enable:no-unused-variable - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name @@ -33,8 +32,7 @@ export class EthBalanceCheckerContract extends BaseContract { addresses: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isArray('addresses', addresses); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -44,9 +42,8 @@ export class EthBalanceCheckerContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as EthBalanceCheckerContract; - const encodedData = self._strictEncodeArguments('getEthBalances(address[])', [addresses - ]); + const self = (this as any) as EthBalanceCheckerContract; + const encodedData = self._strictEncodeArguments('getEthBalances(address[])', [addresses]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -55,32 +52,30 @@ export class EthBalanceCheckerContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getEthBalances(address[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - addresses: string[], - ): string { + getABIEncodedTransactionData(addresses: string[]): string { assert.isArray('addresses', addresses); - const self = this as any as EthBalanceCheckerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getEthBalances(address[])', [addresses - ]); + const self = (this as any) as EthBalanceCheckerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getEthBalances(address[])', [addresses]); return abiEncodedTransactionData; }, }; -public static async deployFrom0xArtifactAsync( + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -93,8 +88,11 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); - return EthBalanceCheckerContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, + ); + return EthBalanceCheckerContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( bytecode: string, @@ -111,17 +109,13 @@ public static async deployFrom0xArtifactAsync( ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); + [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -129,18 +123,22 @@ public static async deployFrom0xArtifactAsync( logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`EthBalanceChecker successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new EthBalanceCheckerContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); + const contractInstance = new EthBalanceCheckerContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + logDecodeDependencies, + ); contractInstance.constructorArgs = []; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -162,11 +160,23 @@ public static async deployFrom0xArtifactAsync( ] as ContractAbi; return abi; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { - super('EthBalanceChecker', EthBalanceCheckerContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { + super( + 'EthBalanceChecker', + EthBalanceCheckerContract.ABI(), + address, + supportedProvider, + txDefaults, + logDecodeDependencies, + ); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts index 460a0c1d6d..873bde5b79 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts @@ -1,11 +1,14 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, +import { + BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; + SubscriptionManager, + PromiseWithTransactionHash, +} from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -83,7 +86,6 @@ export interface ExchangeAssetProxyRegisteredEventArgs extends DecodedLogArgs { assetProxy: string; } - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name @@ -93,8 +95,7 @@ export class ExchangeContract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -104,9 +105,8 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('filled(bytes32)', [index_0 - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('filled(bytes32)', [index_0]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -115,128 +115,179 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('filled(bytes32)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: string, - ): string { + getABIEncodedTransactionData(index_0: string): string { assert.isString('index_0', index_0); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('filled(bytes32)', [index_0 - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('filled(bytes32)', [index_0]); return abiEncodedTransactionData; }, }; public batchFillOrders = { async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmounts: BigNumber[], signatures: string[], - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, - takerAssetFillAmounts, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.batchFillOrders.estimateGasAsync.bind( - self, - orders, - takerAssetFillAmounts, - signatures - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', + [orders, takerAssetFillAmounts, signatures], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.batchFillOrders.estimateGasAsync.bind(self, orders, takerAssetFillAmounts, signatures), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmounts: BigNumber[], signatures: string[], txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const txHashPromise = self.batchFillOrders.sendTransactionAsync(orders, - takerAssetFillAmounts, - signatures - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.batchFillOrders.sendTransactionAsync( + orders, + takerAssetFillAmounts, + signatures, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmounts: BigNumber[], signatures: string[], txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, - takerAssetFillAmounts, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', + [orders, takerAssetFillAmounts, signatures], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmounts: BigNumber[], signatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { + ): Promise<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }> { assert.isArray('orders', orders); assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); assert.isArray('signatures', signatures); @@ -248,11 +299,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, - takerAssetFillAmounts, - signatures - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', + [orders, takerAssetFillAmounts, signatures], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -261,30 +312,51 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])'); + const abiEncoder = self._lookupAbiEncoder( + 'batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }>(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - ): string { + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, + takerAssetFillAmounts: BigNumber[], + signatures: string[], + ): string { assert.isArray('orders', orders); assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, - takerAssetFillAmounts, - signatures - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', + [orders, takerAssetFillAmounts, signatures], + ); return abiEncodedTransactionData; }, }; @@ -293,8 +365,7 @@ export class ExchangeContract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -304,9 +375,8 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('cancelled(bytes32)', [index_0 - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('cancelled(bytes32)', [index_0]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -315,24 +385,22 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('cancelled(bytes32)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: string, - ): string { + getABIEncodedTransactionData(index_0: string): string { assert.isString('index_0', index_0); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('cancelled(bytes32)', [index_0 - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('cancelled(bytes32)', [index_0]); return abiEncodedTransactionData; }, }; @@ -341,36 +409,32 @@ export class ExchangeContract extends BaseContract { hash: string, signerAddress: string, signature: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('hash', hash); - assert.isString('signerAddress', signerAddress); - assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [hash, - signerAddress.toLowerCase(), - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.preSign.estimateGasAsync.bind( - self, + assert.isString('hash', hash); + assert.isString('signerAddress', signerAddress); + assert.isString('signature', signature); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [ hash, signerAddress.toLowerCase(), - signature - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + signature, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.preSign.estimateGasAsync.bind(self, hash, signerAddress.toLowerCase(), signature), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( hash: string, @@ -380,25 +444,27 @@ export class ExchangeContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('hash', hash); - assert.isString('signerAddress', signerAddress); - assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const txHashPromise = self.preSign.sendTransactionAsync(hash, - signerAddress.toLowerCase(), - signature - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('hash', hash); + assert.isString('signerAddress', signerAddress); + assert.isString('signature', signature); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.preSign.sendTransactionAsync( + hash, + signerAddress.toLowerCase(), + signature, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( hash: string, @@ -406,28 +472,29 @@ export class ExchangeContract extends BaseContract { signature: string, txData?: Partial | undefined, ): Promise { - assert.isString('hash', hash); - assert.isString('signerAddress', signerAddress); - assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [hash, - signerAddress.toLowerCase(), - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('hash', hash); + assert.isString('signerAddress', signerAddress); + assert.isString('signature', signature); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [ + hash, + signerAddress.toLowerCase(), + signature, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( hash: string, @@ -435,8 +502,7 @@ export class ExchangeContract extends BaseContract { signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('hash', hash); assert.isString('signerAddress', signerAddress); assert.isString('signature', signature); @@ -448,11 +514,12 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [hash, - signerAddress.toLowerCase(), - signature - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [ + hash, + signerAddress.toLowerCase(), + signature, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -461,147 +528,248 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('preSign(bytes32,address,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - hash: string, - signerAddress: string, - signature: string, - ): string { + getABIEncodedTransactionData(hash: string, signerAddress: string, signature: string): string { assert.isString('hash', hash); assert.isString('signerAddress', signerAddress); assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [hash, - signerAddress.toLowerCase(), - signature - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [ + hash, + signerAddress.toLowerCase(), + signature, + ]); return abiEncodedTransactionData; }, }; public matchOrders = { async sendTransactionAsync( - leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + leftOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, + rightOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, leftSignature: string, rightSignature: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - - - assert.isString('leftSignature', leftSignature); - assert.isString('rightSignature', rightSignature); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [leftOrder, - rightOrder, - leftSignature, - rightSignature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.matchOrders.estimateGasAsync.bind( - self, - leftOrder, - rightOrder, - leftSignature, - rightSignature - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isString('leftSignature', leftSignature); + assert.isString('rightSignature', rightSignature); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', + [leftOrder, rightOrder, leftSignature, rightSignature], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.matchOrders.estimateGasAsync.bind(self, leftOrder, rightOrder, leftSignature, rightSignature), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + leftOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, + rightOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, leftSignature: string, rightSignature: string, txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - - - assert.isString('leftSignature', leftSignature); - assert.isString('rightSignature', rightSignature); - const self = this as any as ExchangeContract; - const txHashPromise = self.matchOrders.sendTransactionAsync(leftOrder, - rightOrder, - leftSignature, - rightSignature - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('leftSignature', leftSignature); + assert.isString('rightSignature', rightSignature); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.matchOrders.sendTransactionAsync( + leftOrder, + rightOrder, + leftSignature, + rightSignature, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + leftOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, + rightOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, leftSignature: string, rightSignature: string, txData?: Partial | undefined, ): Promise { - - - assert.isString('leftSignature', leftSignature); - assert.isString('rightSignature', rightSignature); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [leftOrder, - rightOrder, - leftSignature, - rightSignature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('leftSignature', leftSignature); + assert.isString('rightSignature', rightSignature); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', + [leftOrder, rightOrder, leftSignature, rightSignature], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + leftOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, + rightOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, leftSignature: string, rightSignature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber} - > { - - + ): Promise<{ + left: { + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }; + right: { + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }; + leftMakerAssetSpreadAmount: BigNumber; + }> { assert.isString('leftSignature', leftSignature); assert.isString('rightSignature', rightSignature); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -612,12 +780,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [leftOrder, - rightOrder, - leftSignature, - rightSignature - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', + [leftOrder, rightOrder, leftSignature, rightSignature], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -626,138 +793,227 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(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)'); + const abiEncoder = self._lookupAbiEncoder( + 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber} - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{ + left: { + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }; + right: { + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }; + leftMakerAssetSpreadAmount: BigNumber; + }>(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - leftSignature: string, - rightSignature: string, - ): string { - - + leftOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, + rightOrder: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, + leftSignature: string, + rightSignature: string, + ): string { assert.isString('leftSignature', leftSignature); assert.isString('rightSignature', rightSignature); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [leftOrder, - rightOrder, - leftSignature, - rightSignature - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', + [leftOrder, rightOrder, leftSignature, rightSignature], + ); return abiEncodedTransactionData; }, }; public fillOrderNoThrow = { async sendTransactionAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, takerAssetFillAmount: BigNumber, signature: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, - takerAssetFillAmount, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.fillOrderNoThrow.estimateGasAsync.bind( - self, - order, - takerAssetFillAmount, - signature - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', + [order, takerAssetFillAmount, signature], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.fillOrderNoThrow.estimateGasAsync.bind(self, order, takerAssetFillAmount, signature), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, takerAssetFillAmount: BigNumber, signature: string, txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const txHashPromise = self.fillOrderNoThrow.sendTransactionAsync(order, - takerAssetFillAmount, - signature - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.fillOrderNoThrow.sendTransactionAsync( + order, + takerAssetFillAmount, + signature, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, takerAssetFillAmount: BigNumber, signature: string, txData?: Partial | undefined, ): Promise { - - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, - takerAssetFillAmount, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', + [order, takerAssetFillAmount, signature], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, takerAssetFillAmount: BigNumber, signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { - + ): Promise<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }> { assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -768,11 +1024,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, - takerAssetFillAmount, - signature - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', + [order, takerAssetFillAmount, signature], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -781,40 +1037,55 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)'); + const abiEncoder = self._lookupAbiEncoder( + 'fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }>(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - signature: string, - ): string { - + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, + takerAssetFillAmount: BigNumber, + signature: string, + ): string { assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, - takerAssetFillAmount, - signature - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', + [order, takerAssetFillAmount, signature], + ); return abiEncodedTransactionData; }, }; public assetProxies = { - async callAsync( - index_0: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(index_0: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -824,9 +1095,8 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0 - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -835,106 +1105,155 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('assetProxies(bytes4)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: string, - ): string { + getABIEncodedTransactionData(index_0: string): string { assert.isString('index_0', index_0); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0 - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0]); return abiEncodedTransactionData; }, }; public batchCancelOrders = { async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - txData?: Partial | undefined, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.batchCancelOrders.estimateGasAsync.bind( - self, - orders - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - awaitTransactionSuccessAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, - ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - const self = this as any as ExchangeContract; - const txHashPromise = self.batchCancelOrders.sendTransactionAsync(orders - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', + [orders], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.batchCancelOrders.estimateGasAsync.bind(self, orders), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + awaitTransactionSuccessAsync( + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, + txData?: Partial, + pollingIntervalMs?: number, + timeoutMs?: number, + ): PromiseWithTransactionHash { + assert.isArray('orders', orders); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.batchCancelOrders.sendTransactionAsync(orders, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', + [orders], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isArray('orders', orders); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -944,9 +1263,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', + [orders], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -955,128 +1276,199 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])'); + const abiEncoder = self._lookupAbiEncoder( + 'batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - ): string { + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, + ): string { assert.isArray('orders', orders); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', + [orders], + ); return abiEncodedTransactionData; }, }; public batchFillOrKillOrders = { async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmounts: BigNumber[], signatures: string[], - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, - takerAssetFillAmounts, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.batchFillOrKillOrders.estimateGasAsync.bind( - self, - orders, - takerAssetFillAmounts, - signatures - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', + [orders, takerAssetFillAmounts, signatures], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.batchFillOrKillOrders.estimateGasAsync.bind(self, orders, takerAssetFillAmounts, signatures), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmounts: BigNumber[], signatures: string[], txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const txHashPromise = self.batchFillOrKillOrders.sendTransactionAsync(orders, - takerAssetFillAmounts, - signatures - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.batchFillOrKillOrders.sendTransactionAsync( + orders, + takerAssetFillAmounts, + signatures, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmounts: BigNumber[], signatures: string[], txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, - takerAssetFillAmounts, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', + [orders, takerAssetFillAmounts, signatures], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmounts: BigNumber[], signatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { + ): Promise<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }> { assert.isArray('orders', orders); assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); assert.isArray('signatures', signatures); @@ -1088,11 +1480,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, - takerAssetFillAmounts, - signatures - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', + [orders, takerAssetFillAmounts, signatures], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1101,60 +1493,74 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])'); + const abiEncoder = self._lookupAbiEncoder( + 'batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }>(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - ): string { + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, + takerAssetFillAmounts: BigNumber[], + signatures: string[], + ): string { assert.isArray('orders', orders); assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, - takerAssetFillAmounts, - signatures - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', + [orders, takerAssetFillAmounts, signatures], + ); return abiEncodedTransactionData; }, }; public cancelOrdersUpTo = { - async sendTransactionAsync( - targetOrderEpoch: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.cancelOrdersUpTo.estimateGasAsync.bind( - self, - targetOrderEpoch - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(targetOrderEpoch: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.cancelOrdersUpTo.estimateGasAsync.bind(self, targetOrderEpoch), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( targetOrderEpoch: BigNumber, @@ -1162,51 +1568,45 @@ export class ExchangeContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); - const self = this as any as ExchangeContract; - const txHashPromise = self.cancelOrdersUpTo.sendTransactionAsync(targetOrderEpoch - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.cancelOrdersUpTo.sendTransactionAsync(targetOrderEpoch, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - targetOrderEpoch: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(targetOrderEpoch: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( targetOrderEpoch: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1216,9 +1616,8 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1227,128 +1626,181 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('cancelOrdersUpTo(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - targetOrderEpoch: BigNumber, - ): string { + getABIEncodedTransactionData(targetOrderEpoch: BigNumber): string { assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [ + targetOrderEpoch, + ]); return abiEncodedTransactionData; }, }; public batchFillOrdersNoThrow = { async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmounts: BigNumber[], signatures: string[], - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, - takerAssetFillAmounts, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.batchFillOrdersNoThrow.estimateGasAsync.bind( - self, - orders, - takerAssetFillAmounts, - signatures - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', + [orders, takerAssetFillAmounts, signatures], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.batchFillOrdersNoThrow.estimateGasAsync.bind(self, orders, takerAssetFillAmounts, signatures), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmounts: BigNumber[], signatures: string[], txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const txHashPromise = self.batchFillOrdersNoThrow.sendTransactionAsync(orders, - takerAssetFillAmounts, - signatures - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.batchFillOrdersNoThrow.sendTransactionAsync( + orders, + takerAssetFillAmounts, + signatures, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmounts: BigNumber[], signatures: string[], txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, - takerAssetFillAmounts, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', + [orders, takerAssetFillAmounts, signatures], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmounts: BigNumber[], signatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { + ): Promise<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }> { assert.isArray('orders', orders); assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); assert.isArray('signatures', signatures); @@ -1360,11 +1812,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, - takerAssetFillAmounts, - signatures - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', + [orders, takerAssetFillAmounts, signatures], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1373,30 +1825,51 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])'); + const abiEncoder = self._lookupAbiEncoder( + 'batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }>(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - ): string { + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, + takerAssetFillAmounts: BigNumber[], + signatures: string[], + ): string { assert.isArray('orders', orders); assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, - takerAssetFillAmounts, - signatures - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', + [orders, takerAssetFillAmounts, signatures], + ); return abiEncodedTransactionData; }, }; @@ -1405,8 +1878,7 @@ export class ExchangeContract extends BaseContract { assetProxyId: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('assetProxyId', assetProxyId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1416,9 +1888,8 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1427,24 +1898,22 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAssetProxy(bytes4)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - assetProxyId: string, - ): string { + getABIEncodedTransactionData(assetProxyId: string): string { assert.isString('assetProxyId', assetProxyId); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId]); return abiEncodedTransactionData; }, }; @@ -1453,8 +1922,7 @@ export class ExchangeContract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -1464,9 +1932,8 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('transactions(bytes32)', [index_0 - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('transactions(bytes32)', [index_0]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1475,129 +1942,176 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transactions(bytes32)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: string, - ): string { + getABIEncodedTransactionData(index_0: string): string { assert.isString('index_0', index_0); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transactions(bytes32)', [index_0 - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transactions(bytes32)', [index_0]); return abiEncodedTransactionData; }, }; public fillOrKillOrder = { async sendTransactionAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, takerAssetFillAmount: BigNumber, signature: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, - takerAssetFillAmount, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.fillOrKillOrder.estimateGasAsync.bind( - self, - order, - takerAssetFillAmount, - signature - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', + [order, takerAssetFillAmount, signature], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.fillOrKillOrder.estimateGasAsync.bind(self, order, takerAssetFillAmount, signature), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, takerAssetFillAmount: BigNumber, signature: string, txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const txHashPromise = self.fillOrKillOrder.sendTransactionAsync(order, - takerAssetFillAmount, - signature - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.fillOrKillOrder.sendTransactionAsync( + order, + takerAssetFillAmount, + signature, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, takerAssetFillAmount: BigNumber, signature: string, txData?: Partial | undefined, ): Promise { - - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, - takerAssetFillAmount, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', + [order, takerAssetFillAmount, signature], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, takerAssetFillAmount: BigNumber, signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { - + ): Promise<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }> { assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -1608,11 +2122,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, - takerAssetFillAmount, - signature - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', + [order, takerAssetFillAmount, signature], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1621,30 +2135,50 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)'); + const abiEncoder = self._lookupAbiEncoder( + 'fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }>(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - signature: string, - ): string { - + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, + takerAssetFillAmount: BigNumber, + signature: string, + ): string { assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, - takerAssetFillAmount, - signature - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', + [order, takerAssetFillAmount, signature], + ); return abiEncodedTransactionData; }, }; @@ -1652,33 +2186,34 @@ export class ExchangeContract extends BaseContract { async sendTransactionAsync( validatorAddress: string, approval: boolean, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('validatorAddress', validatorAddress); - assert.isBoolean('approval', approval); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [validatorAddress.toLowerCase(), - approval - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.setSignatureValidatorApproval.estimateGasAsync.bind( - self, + assert.isString('validatorAddress', validatorAddress); + assert.isBoolean('approval', approval); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [ validatorAddress.toLowerCase(), - approval - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + approval, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.setSignatureValidatorApproval.estimateGasAsync.bind( + self, + validatorAddress.toLowerCase(), + approval, + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( validatorAddress: string, @@ -1687,57 +2222,59 @@ export class ExchangeContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('validatorAddress', validatorAddress); - assert.isBoolean('approval', approval); - const self = this as any as ExchangeContract; - const txHashPromise = self.setSignatureValidatorApproval.sendTransactionAsync(validatorAddress.toLowerCase(), - approval - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('validatorAddress', validatorAddress); + assert.isBoolean('approval', approval); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.setSignatureValidatorApproval.sendTransactionAsync( + validatorAddress.toLowerCase(), + approval, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( validatorAddress: string, approval: boolean, txData?: Partial | undefined, ): Promise { - assert.isString('validatorAddress', validatorAddress); - assert.isBoolean('approval', approval); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [validatorAddress.toLowerCase(), - approval - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('validatorAddress', validatorAddress); + assert.isBoolean('approval', approval); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [ + validatorAddress.toLowerCase(), + approval, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( validatorAddress: string, approval: boolean, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('validatorAddress', validatorAddress); assert.isBoolean('approval', approval); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -1748,10 +2285,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [validatorAddress.toLowerCase(), - approval - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [ + validatorAddress.toLowerCase(), + approval, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1760,27 +2298,26 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('setSignatureValidatorApproval(address,bool)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - validatorAddress: string, - approval: boolean, - ): string { + getABIEncodedTransactionData(validatorAddress: string, approval: boolean): string { assert.isString('validatorAddress', validatorAddress); assert.isBoolean('approval', approval); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [validatorAddress.toLowerCase(), - approval - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'setSignatureValidatorApproval(address,bool)', + [validatorAddress.toLowerCase(), approval], + ); return abiEncodedTransactionData; }, }; @@ -1790,8 +2327,7 @@ export class ExchangeContract extends BaseContract { index_1: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.isString('index_1', index_1); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -1802,10 +2338,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('allowedValidators(address,address)', [index_0.toLowerCase(), - index_1.toLowerCase() - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('allowedValidators(address,address)', [ + index_0.toLowerCase(), + index_1.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1814,131 +2351,183 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('allowedValidators(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: string, - index_1: string, - ): string { + getABIEncodedTransactionData(index_0: string, index_1: string): string { assert.isString('index_0', index_0); assert.isString('index_1', index_1); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('allowedValidators(address,address)', [index_0.toLowerCase(), - index_1.toLowerCase() - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('allowedValidators(address,address)', [ + index_0.toLowerCase(), + index_1.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public marketSellOrders = { async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmount: BigNumber, signatures: string[], - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - takerAssetFillAmount, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.marketSellOrders.estimateGasAsync.bind( - self, - orders, - takerAssetFillAmount, - signatures - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isArray('orders', orders); + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + [orders, takerAssetFillAmount, signatures], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.marketSellOrders.estimateGasAsync.bind(self, orders, takerAssetFillAmount, signatures), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const txHashPromise = self.marketSellOrders.sendTransactionAsync(orders, - takerAssetFillAmount, - signatures - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.marketSellOrders.sendTransactionAsync( + orders, + takerAssetFillAmount, + signatures, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - takerAssetFillAmount, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + [orders, takerAssetFillAmount, signatures], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmount: BigNumber, signatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { + ): Promise<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }> { assert.isArray('orders', orders); assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isArray('signatures', signatures); @@ -1950,11 +2539,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - takerAssetFillAmount, - signatures - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + [orders, takerAssetFillAmount, signatures], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1963,40 +2552,73 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); + const abiEncoder = self._lookupAbiEncoder( + 'marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }>(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmount: BigNumber, - signatures: string[], - ): string { + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, + takerAssetFillAmount: BigNumber, + signatures: string[], + ): string { assert.isArray('orders', orders); assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - takerAssetFillAmount, - signatures - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + [orders, takerAssetFillAmount, signatures], + ); return abiEncodedTransactionData; }, }; public getOrdersInfo = { async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise - > { + ): Promise> { assert.isArray('orders', orders); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -2006,9 +2628,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', + [orders], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2017,24 +2641,44 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])'); + const abiEncoder = self._lookupAbiEncoder( + 'getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue< + Array<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }> + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - ): string { + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, + ): string { assert.isArray('orders', orders); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', + [orders], + ); return abiEncodedTransactionData; }, }; @@ -2044,8 +2688,7 @@ export class ExchangeContract extends BaseContract { index_1: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.isString('index_1', index_1); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -2056,10 +2699,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('preSigned(bytes32,address)', [index_0, - index_1.toLowerCase() - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('preSigned(bytes32,address)', [ + index_0, + index_1.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2068,36 +2712,31 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('preSigned(bytes32,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: string, - index_1: string, - ): string { + getABIEncodedTransactionData(index_0: string, index_1: string): string { assert.isString('index_0', index_0); assert.isString('index_1', index_1); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('preSigned(bytes32,address)', [index_0, - index_1.toLowerCase() - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('preSigned(bytes32,address)', [ + index_0, + index_1.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public owner = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -2106,7 +2745,7 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; + const self = (this as any) as ExchangeContract; const encodedData = self._strictEncodeArguments('owner()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -2116,20 +2755,20 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as ExchangeContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as ExchangeContract; const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); return abiEncodedTransactionData; }, @@ -2141,8 +2780,7 @@ export class ExchangeContract extends BaseContract { signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('hash', hash); assert.isString('signerAddress', signerAddress); assert.isString('signature', signature); @@ -2154,11 +2792,12 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [hash, - signerAddress.toLowerCase(), - signature - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [ + hash, + signerAddress.toLowerCase(), + signature, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2167,134 +2806,185 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isValidSignature(bytes32,address,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - hash: string, - signerAddress: string, - signature: string, - ): string { + getABIEncodedTransactionData(hash: string, signerAddress: string, signature: string): string { assert.isString('hash', hash); assert.isString('signerAddress', signerAddress); assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [hash, - signerAddress.toLowerCase(), - signature - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [ + hash, + signerAddress.toLowerCase(), + signature, + ]); return abiEncodedTransactionData; }, }; public marketBuyOrdersNoThrow = { async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, makerAssetFillAmount: BigNumber, signatures: string[], - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - makerAssetFillAmount, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.marketBuyOrdersNoThrow.estimateGasAsync.bind( - self, - orders, - makerAssetFillAmount, - signatures - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + [orders, makerAssetFillAmount, signatures], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.marketBuyOrdersNoThrow.estimateGasAsync.bind(self, orders, makerAssetFillAmount, signatures), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, makerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const txHashPromise = self.marketBuyOrdersNoThrow.sendTransactionAsync(orders, - makerAssetFillAmount, - signatures - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.marketBuyOrdersNoThrow.sendTransactionAsync( + orders, + makerAssetFillAmount, + signatures, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, makerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - makerAssetFillAmount, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + [orders, makerAssetFillAmount, signatures], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, makerAssetFillAmount: BigNumber, signatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { + ): Promise<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }> { assert.isArray('orders', orders); assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); assert.isArray('signatures', signatures); @@ -2306,11 +2996,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - makerAssetFillAmount, - signatures - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + [orders, makerAssetFillAmount, signatures], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2319,135 +3009,200 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); + const abiEncoder = self._lookupAbiEncoder( + 'marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }>(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - makerAssetFillAmount: BigNumber, - signatures: string[], - ): string { + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, + makerAssetFillAmount: BigNumber, + signatures: string[], + ): string { assert.isArray('orders', orders); assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - makerAssetFillAmount, - signatures - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + [orders, makerAssetFillAmount, signatures], + ); return abiEncodedTransactionData; }, }; public fillOrder = { async sendTransactionAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, takerAssetFillAmount: BigNumber, signature: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, - takerAssetFillAmount, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.fillOrder.estimateGasAsync.bind( - self, - order, - takerAssetFillAmount, - signature - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', + [order, takerAssetFillAmount, signature], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.fillOrder.estimateGasAsync.bind(self, order, takerAssetFillAmount, signature), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, takerAssetFillAmount: BigNumber, signature: string, txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const txHashPromise = self.fillOrder.sendTransactionAsync(order, - takerAssetFillAmount, - signature - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.fillOrder.sendTransactionAsync(order, takerAssetFillAmount, signature, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, takerAssetFillAmount: BigNumber, signature: string, txData?: Partial | undefined, ): Promise { - - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, - takerAssetFillAmount, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', + [order, takerAssetFillAmount, signature], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, takerAssetFillAmount: BigNumber, signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { - + ): Promise<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }> { assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -2458,11 +3213,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, - takerAssetFillAmount, - signature - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', + [order, takerAssetFillAmount, signature], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2471,30 +3226,50 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)'); + const abiEncoder = self._lookupAbiEncoder( + 'fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }>(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - signature: string, - ): string { - + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, + takerAssetFillAmount: BigNumber, + signature: string, + ): string { assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, - takerAssetFillAmount, - signature - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', + [order, takerAssetFillAmount, signature], + ); return abiEncodedTransactionData; }, }; @@ -2504,39 +3279,34 @@ export class ExchangeContract extends BaseContract { signerAddress: string, data: string, signature: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isBigNumber('salt', salt); - assert.isString('signerAddress', signerAddress); - assert.isString('data', data); - assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [salt, - signerAddress.toLowerCase(), - data, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.executeTransaction.estimateGasAsync.bind( - self, + assert.isBigNumber('salt', salt); + assert.isString('signerAddress', signerAddress); + assert.isString('data', data); + assert.isString('signature', signature); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [ salt, signerAddress.toLowerCase(), data, - signature - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + signature, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.executeTransaction.estimateGasAsync.bind(self, salt, signerAddress.toLowerCase(), data, signature), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( salt: BigNumber, @@ -2547,27 +3317,29 @@ export class ExchangeContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('salt', salt); - assert.isString('signerAddress', signerAddress); - assert.isString('data', data); - assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const txHashPromise = self.executeTransaction.sendTransactionAsync(salt, - signerAddress.toLowerCase(), - data, - signature - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('salt', salt); + assert.isString('signerAddress', signerAddress); + assert.isString('data', data); + assert.isString('signature', signature); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.executeTransaction.sendTransactionAsync( + salt, + signerAddress.toLowerCase(), + data, + signature, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( salt: BigNumber, @@ -2576,30 +3348,31 @@ export class ExchangeContract extends BaseContract { signature: string, txData?: Partial | undefined, ): Promise { - assert.isBigNumber('salt', salt); - assert.isString('signerAddress', signerAddress); - assert.isString('data', data); - assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [salt, - signerAddress.toLowerCase(), - data, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isBigNumber('salt', salt); + assert.isString('signerAddress', signerAddress); + assert.isString('data', data); + assert.isString('signature', signature); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [ + salt, + signerAddress.toLowerCase(), + data, + signature, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( salt: BigNumber, @@ -2608,8 +3381,7 @@ export class ExchangeContract extends BaseContract { signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('salt', salt); assert.isString('signerAddress', signerAddress); assert.isString('data', data); @@ -2622,12 +3394,13 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [salt, - signerAddress.toLowerCase(), - data, - signature - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [ + salt, + signerAddress.toLowerCase(), + data, + signature, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2636,63 +3409,51 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('executeTransaction(uint256,address,bytes,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - salt: BigNumber, - signerAddress: string, - data: string, - signature: string, - ): string { + getABIEncodedTransactionData(salt: BigNumber, signerAddress: string, data: string, signature: string): string { assert.isBigNumber('salt', salt); assert.isString('signerAddress', signerAddress); assert.isString('data', data); assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [salt, - signerAddress.toLowerCase(), - data, - signature - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'executeTransaction(uint256,address,bytes,bytes)', + [salt, signerAddress.toLowerCase(), data, signature], + ); return abiEncodedTransactionData; }, }; public registerAssetProxy = { - async sendTransactionAsync( - assetProxy: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('assetProxy', assetProxy); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.registerAssetProxy.estimateGasAsync.bind( - self, - assetProxy.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(assetProxy: string, txData?: Partial | undefined): Promise { + assert.isString('assetProxy', assetProxy); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.registerAssetProxy.estimateGasAsync.bind(self, assetProxy.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( assetProxy: string, @@ -2700,51 +3461,45 @@ export class ExchangeContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('assetProxy', assetProxy); - const self = this as any as ExchangeContract; - const txHashPromise = self.registerAssetProxy.sendTransactionAsync(assetProxy.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('assetProxy', assetProxy); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.registerAssetProxy.sendTransactionAsync(assetProxy.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - assetProxy: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('assetProxy', assetProxy); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(assetProxy: string, txData?: Partial | undefined): Promise { + assert.isString('assetProxy', assetProxy); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( assetProxy: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('assetProxy', assetProxy); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -2754,9 +3509,8 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase() - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2765,35 +3519,46 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - assetProxy: string, - ): string { + getABIEncodedTransactionData(assetProxy: string): string { assert.isString('assetProxy', assetProxy); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase() - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address)', [ + assetProxy.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public getOrderInfo = { async callAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber} - > { - + ): Promise<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }> { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -2802,9 +3567,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', + [order], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2813,107 +3580,173 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))'); + const abiEncoder = self._lookupAbiEncoder( + 'getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber} - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{ + orderStatus: number; + orderHash: string; + orderTakerAssetFilledAmount: BigNumber; + }>(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - ): string { - - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order - ]); + getABIEncodedTransactionData(order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }): string { + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', + [order], + ); return abiEncodedTransactionData; }, }; public cancelOrder = { async sendTransactionAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - txData?: Partial | undefined, - ): Promise { - - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; }, - self._web3Wrapper.getContractDefaults(), - self.cancelOrder.estimateGasAsync.bind( - self, - order - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + txData?: Partial | undefined, + ): Promise { + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', + [order], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.cancelOrder.estimateGasAsync.bind(self, order), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - - const self = this as any as ExchangeContract; - const txHashPromise = self.cancelOrder.sendTransactionAsync(order - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.cancelOrder.sendTransactionAsync(order, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, txData?: Partial | undefined, ): Promise { - - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', + [order], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { - + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -2922,9 +3755,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', + [order], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2933,24 +3768,39 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))'); + const abiEncoder = self._lookupAbiEncoder( + 'cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - ): string { - - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order - ]); + getABIEncodedTransactionData(order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }): string { + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', + [order], + ); return abiEncodedTransactionData; }, }; @@ -2960,8 +3810,7 @@ export class ExchangeContract extends BaseContract { index_1: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.isString('index_1', index_1); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -2972,10 +3821,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('orderEpoch(address,address)', [index_0.toLowerCase(), - index_1.toLowerCase() - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('orderEpoch(address,address)', [ + index_0.toLowerCase(), + index_1.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2984,36 +3834,31 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('orderEpoch(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: string, - index_1: string, - ): string { + getABIEncodedTransactionData(index_0: string, index_1: string): string { assert.isString('index_0', index_0); assert.isString('index_1', index_1); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('orderEpoch(address,address)', [index_0.toLowerCase(), - index_1.toLowerCase() - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('orderEpoch(address,address)', [ + index_0.toLowerCase(), + index_1.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public ZRX_ASSET_DATA = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -3022,7 +3867,7 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; + const self = (this as any) as ExchangeContract; const encodedData = self._strictEncodeArguments('ZRX_ASSET_DATA()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -3032,125 +3877,178 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('ZRX_ASSET_DATA()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as ExchangeContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as ExchangeContract; const abiEncodedTransactionData = self._strictEncodeArguments('ZRX_ASSET_DATA()', []); return abiEncodedTransactionData; }, }; public marketSellOrdersNoThrow = { async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmount: BigNumber, signatures: string[], - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - takerAssetFillAmount, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.marketSellOrdersNoThrow.estimateGasAsync.bind( - self, - orders, - takerAssetFillAmount, - signatures - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isArray('orders', orders); + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + [orders, takerAssetFillAmount, signatures], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.marketSellOrdersNoThrow.estimateGasAsync.bind(self, orders, takerAssetFillAmount, signatures), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const txHashPromise = self.marketSellOrdersNoThrow.sendTransactionAsync(orders, - takerAssetFillAmount, - signatures - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.marketSellOrdersNoThrow.sendTransactionAsync( + orders, + takerAssetFillAmount, + signatures, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - takerAssetFillAmount, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + [orders, takerAssetFillAmount, signatures], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAssetFillAmount: BigNumber, signatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { + ): Promise<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }> { assert.isArray('orders', orders); assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isArray('signatures', signatures); @@ -3162,11 +4060,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - takerAssetFillAmount, - signatures - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + [orders, takerAssetFillAmount, signatures], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -3175,39 +4073,56 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); + const abiEncoder = self._lookupAbiEncoder( + 'marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }>(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmount: BigNumber, - signatures: string[], - ): string { + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, + takerAssetFillAmount: BigNumber, + signatures: string[], + ): string { assert.isArray('orders', orders); assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - takerAssetFillAmount, - signatures - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + [orders, takerAssetFillAmount, signatures], + ); return abiEncodedTransactionData; }, }; public EIP712_DOMAIN_HASH = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -3216,7 +4131,7 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; + const self = (this as any) as ExchangeContract; const encodedData = self._strictEncodeArguments('EIP712_DOMAIN_HASH()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -3226,125 +4141,178 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('EIP712_DOMAIN_HASH()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as ExchangeContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as ExchangeContract; const abiEncodedTransactionData = self._strictEncodeArguments('EIP712_DOMAIN_HASH()', []); return abiEncodedTransactionData; }, }; public marketBuyOrders = { async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, makerAssetFillAmount: BigNumber, signatures: string[], - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - makerAssetFillAmount, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.marketBuyOrders.estimateGasAsync.bind( - self, - orders, - makerAssetFillAmount, - signatures - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + [orders, makerAssetFillAmount, signatures], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.marketBuyOrders.estimateGasAsync.bind(self, orders, makerAssetFillAmount, signatures), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, makerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const txHashPromise = self.marketBuyOrders.sendTransactionAsync(orders, - makerAssetFillAmount, - signatures - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.marketBuyOrders.sendTransactionAsync( + orders, + makerAssetFillAmount, + signatures, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, makerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - makerAssetFillAmount, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + [orders, makerAssetFillAmount, signatures], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, makerAssetFillAmount: BigNumber, signatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { + ): Promise<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }> { assert.isArray('orders', orders); assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); assert.isArray('signatures', signatures); @@ -3356,11 +4324,11 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - makerAssetFillAmount, - signatures - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + [orders, makerAssetFillAmount, signatures], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -3369,39 +4337,56 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); + const abiEncoder = self._lookupAbiEncoder( + 'marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{ + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }>(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - makerAssetFillAmount: BigNumber, - signatures: string[], - ): string { + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, + makerAssetFillAmount: BigNumber, + signatures: string[], + ): string { assert.isArray('orders', orders); assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - makerAssetFillAmount, - signatures - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', + [orders, makerAssetFillAmount, signatures], + ); return abiEncodedTransactionData; }, }; public currentContextAddress = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -3410,7 +4395,7 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; + const self = (this as any) as ExchangeContract; const encodedData = self._strictEncodeArguments('currentContextAddress()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -3420,51 +4405,44 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('currentContextAddress()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as ExchangeContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as ExchangeContract; const abiEncodedTransactionData = self._strictEncodeArguments('currentContextAddress()', []); return abiEncodedTransactionData; }, }; public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('newOwner', newOwner); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind( - self, - newOwner.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( newOwner: string, @@ -3472,51 +4450,41 @@ export class ExchangeContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('newOwner', newOwner); - const self = this as any as ExchangeContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('newOwner', newOwner); + const self = (this as any) as ExchangeContract; + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - newOwner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('newOwner', newOwner); - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - newOwner: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -3526,9 +4494,8 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -3537,33 +4504,29 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - newOwner: string, - ): string { + getABIEncodedTransactionData(newOwner: string): string { assert.isString('newOwner', newOwner); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); + const self = (this as any) as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ + newOwner.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public VERSION = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -3572,7 +4535,7 @@ export class ExchangeContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ExchangeContract; + const self = (this as any) as ExchangeContract; const encodedData = self._strictEncodeArguments('VERSION()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -3582,31 +4545,31 @@ export class ExchangeContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('VERSION()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as ExchangeContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as ExchangeContract; const abiEncodedTransactionData = self._strictEncodeArguments('VERSION()', []); return abiEncodedTransactionData; }, }; -private readonly _subscriptionManager: SubscriptionManager; -public static async deployFrom0xArtifactAsync( + private readonly _subscriptionManager: SubscriptionManager; + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, - _zrxAssetData: string, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + _zrxAssetData: string, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -3619,9 +4582,18 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); - return ExchangeContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, _zrxAssetData -); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, + ); + return ExchangeContract.deployAsync( + bytecode, + abi, + provider, + txDefaults, + logDecodeDependenciesAbiOnly, + _zrxAssetData, + ); } public static async deployAsync( bytecode: string, @@ -3629,7 +4601,7 @@ public static async deployFrom0xArtifactAsync( supportedProvider: SupportedProvider, txDefaults: Partial, logDecodeDependencies: { [contractName: string]: ContractAbi }, - _zrxAssetData: string, + _zrxAssetData: string, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -3639,20 +4611,17 @@ public static async deployFrom0xArtifactAsync( ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_zrxAssetData -] = BaseContract._formatABIDataItemList( + [_zrxAssetData] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [_zrxAssetData -], + [_zrxAssetData], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_zrxAssetData -]); + const txData = deployInfo.encode(bytecode, [_zrxAssetData]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -3660,19 +4629,22 @@ public static async deployFrom0xArtifactAsync( logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`Exchange successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ExchangeContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); - contractInstance.constructorArgs = [_zrxAssetData -]; + const contractInstance = new ExchangeContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + logDecodeDependencies, + ); + contractInstance.constructorArgs = [_zrxAssetData]; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -3691,7 +4663,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -3746,7 +4718,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'takerAssetFillAmounts', @@ -3779,14 +4751,14 @@ public static async deployFrom0xArtifactAsync( name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -3805,7 +4777,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -3822,13 +4794,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'preSign', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -3883,7 +4854,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'rightOrder', @@ -3937,7 +4908,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'leftSignature', @@ -3974,7 +4945,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, { name: 'right', @@ -3996,20 +4967,20 @@ public static async deployFrom0xArtifactAsync( name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, { name: 'leftMakerAssetSpreadAmount', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -4064,7 +5035,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'takerAssetFillAmount', @@ -4097,14 +5068,14 @@ public static async deployFrom0xArtifactAsync( name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -4123,7 +5094,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -4178,17 +5149,16 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, ], name: 'batchCancelOrders', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -4243,7 +5213,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'takerAssetFillAmounts', @@ -4276,14 +5246,14 @@ public static async deployFrom0xArtifactAsync( name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -4292,13 +5262,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'cancelOrdersUpTo', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -4353,7 +5322,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'takerAssetFillAmounts', @@ -4386,14 +5355,14 @@ public static async deployFrom0xArtifactAsync( name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -4412,7 +5381,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -4431,7 +5400,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -4486,7 +5455,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'takerAssetFillAmount', @@ -4519,14 +5488,14 @@ public static async deployFrom0xArtifactAsync( name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -4539,13 +5508,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'setSignatureValidatorApproval', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -4568,7 +5536,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -4623,7 +5591,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'takerAssetFillAmount', @@ -4656,14 +5624,14 @@ public static async deployFrom0xArtifactAsync( name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -4718,7 +5686,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, ], name: 'getOrdersInfo', @@ -4739,14 +5707,14 @@ public static async deployFrom0xArtifactAsync( name: 'orderTakerAssetFilledAmount', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -4769,10 +5737,9 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'owner', outputs: [ { @@ -4784,7 +5751,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -4811,7 +5778,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -4866,7 +5833,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'makerAssetFillAmount', @@ -4899,14 +5866,14 @@ public static async deployFrom0xArtifactAsync( name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -4961,7 +5928,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'takerAssetFillAmount', @@ -4994,14 +5961,14 @@ public static async deployFrom0xArtifactAsync( name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -5022,13 +5989,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'executeTransaction', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -5037,13 +6003,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'registerAssetProxy', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -5098,7 +6063,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, ], name: 'getOrderInfo', @@ -5119,14 +6084,14 @@ public static async deployFrom0xArtifactAsync( name: 'orderTakerAssetFilledAmount', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -5181,17 +6146,16 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, ], name: 'cancelOrder', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -5214,10 +6178,9 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'ZRX_ASSET_DATA', outputs: [ { @@ -5229,7 +6192,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -5284,7 +6247,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'takerAssetFillAmount', @@ -5317,17 +6280,16 @@ public static async deployFrom0xArtifactAsync( name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'EIP712_DOMAIN_HASH', outputs: [ { @@ -5339,7 +6301,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -5394,7 +6356,7 @@ public static async deployFrom0xArtifactAsync( name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'makerAssetFillAmount', @@ -5427,17 +6389,16 @@ public static async deployFrom0xArtifactAsync( name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'currentContextAddress', outputs: [ { @@ -5449,7 +6410,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -5458,16 +6419,14 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'transferOwnership', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'VERSION', outputs: [ { @@ -5479,20 +6438,19 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { inputs: [ { name: '_zrxAssetData', type: 'bytes', }, ], - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'constructor', }, - { + { anonymous: false, inputs: [ { @@ -5512,11 +6470,10 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'SignatureValidatorApproval', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -5576,11 +6533,10 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'Fill', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -5615,11 +6571,10 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'Cancel', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -5639,11 +6594,10 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'CancelUpTo', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -5658,8 +6612,7 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'AssetProxyRegistered', - outputs: [ - ], + outputs: [], type: 'event', }, ] as ContractAbi; @@ -5733,7 +6686,12 @@ public static async deployFrom0xArtifactAsync( ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { super('Exchange', ExchangeContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( @@ -5741,7 +6699,7 @@ public static async deployFrom0xArtifactAsync( this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts b/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts index efe2ed7409..4a4e7f68ef 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts @@ -1,7 +1,7 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract,PromiseWithTransactionHash } from '@0x/base-contract'; +import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -23,68 +23,123 @@ import { assert } from '@0x/assert'; import * as ethers from 'ethers'; // tslint:enable:no-unused-variable - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class ForwarderContract extends BaseContract { public marketBuyOrdersWithEth = { async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, makerAssetFillAmount: BigNumber, signatures: string[], - feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + feeOrders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, feeSignatures: string[], feePercentage: BigNumber, feeRecipient: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - assert.isArray('feeOrders', feeOrders); - assert.isArray('feeSignatures', feeSignatures); - assert.isBigNumber('feePercentage', feePercentage); - assert.isString('feeRecipient', feeRecipient); - const self = this as any as ForwarderContract; - const encodedData = self._strictEncodeArguments('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.marketBuyOrdersWithEth.estimateGasAsync.bind( - self, - orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + assert.isArray('feeOrders', feeOrders); + assert.isArray('feeSignatures', feeSignatures); + assert.isBigNumber('feePercentage', feePercentage); + assert.isString('feeRecipient', feeRecipient); + const self = (this as any) as ForwarderContract; + const encodedData = self._strictEncodeArguments( + 'marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', + [ + orders, + makerAssetFillAmount, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase(), + ], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.marketBuyOrdersWithEth.estimateGasAsync.bind( + self, + orders, + makerAssetFillAmount, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase(), + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, makerAssetFillAmount: BigNumber, signatures: string[], - feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + feeOrders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, feeSignatures: string[], feePercentage: BigNumber, feeRecipient: string, @@ -92,86 +147,158 @@ export class ForwarderContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - assert.isArray('feeOrders', feeOrders); - assert.isArray('feeSignatures', feeSignatures); - assert.isBigNumber('feePercentage', feePercentage); - assert.isString('feeRecipient', feeRecipient); - const self = this as any as ForwarderContract; - const txHashPromise = self.marketBuyOrdersWithEth.sendTransactionAsync(orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + assert.isArray('feeOrders', feeOrders); + assert.isArray('feeSignatures', feeSignatures); + assert.isBigNumber('feePercentage', feePercentage); + assert.isString('feeRecipient', feeRecipient); + const self = (this as any) as ForwarderContract; + const txHashPromise = self.marketBuyOrdersWithEth.sendTransactionAsync( + orders, + makerAssetFillAmount, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase(), + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, makerAssetFillAmount: BigNumber, signatures: string[], - feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + feeOrders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, feeSignatures: string[], feePercentage: BigNumber, feeRecipient: string, txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - assert.isArray('feeOrders', feeOrders); - assert.isArray('feeSignatures', feeSignatures); - assert.isBigNumber('feePercentage', feePercentage); - assert.isString('feeRecipient', feeRecipient); - const self = this as any as ForwarderContract; - const encodedData = self._strictEncodeArguments('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + assert.isArray('feeOrders', feeOrders); + assert.isArray('feeSignatures', feeSignatures); + assert.isBigNumber('feePercentage', feePercentage); + assert.isString('feeRecipient', feeRecipient); + const self = (this as any) as ForwarderContract; + const encodedData = self._strictEncodeArguments( + 'marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', + [ + orders, + makerAssetFillAmount, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase(), + ], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, makerAssetFillAmount: BigNumber, signatures: string[], - feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + feeOrders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, feeSignatures: string[], feePercentage: BigNumber, feeRecipient: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}] + ): Promise< + [ + { + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }, + { + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + } + ] > { assert.isArray('orders', orders); assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); @@ -188,15 +315,19 @@ export class ForwarderContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ForwarderContract; - const encodedData = self._strictEncodeArguments('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase() - ]); + const self = (this as any) as ForwarderContract; + const encodedData = self._strictEncodeArguments( + 'marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', + [ + orders, + makerAssetFillAmount, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase(), + ], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -205,26 +336,70 @@ export class ForwarderContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(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)'); + const abiEncoder = self._lookupAbiEncoder( + 'marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}] - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue< + [ + { + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }, + { + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + } + ] + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - makerAssetFillAmount: BigNumber, - signatures: string[], - feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - feeSignatures: string[], - feePercentage: BigNumber, - feeRecipient: string, - ): string { + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, + makerAssetFillAmount: BigNumber, + signatures: string[], + feeOrders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, + feeSignatures: string[], + feePercentage: BigNumber, + feeRecipient: string, + ): string { assert.isArray('orders', orders); assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); assert.isArray('signatures', signatures); @@ -232,15 +407,19 @@ export class ForwarderContract extends BaseContract { assert.isArray('feeSignatures', feeSignatures); assert.isBigNumber('feePercentage', feePercentage); assert.isString('feeRecipient', feeRecipient); - const self = this as any as ForwarderContract; - const abiEncodedTransactionData = self._strictEncodeArguments('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase() - ]); + const self = (this as any) as ForwarderContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', + [ + orders, + makerAssetFillAmount, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase(), + ], + ); return abiEncodedTransactionData; }, }; @@ -248,33 +427,27 @@ export class ForwarderContract extends BaseContract { async sendTransactionAsync( assetData: string, amount: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('assetData', assetData); - assert.isBigNumber('amount', amount); - const self = this as any as ForwarderContract; - const encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData, - amount - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.withdrawAsset.estimateGasAsync.bind( - self, - assetData, - amount - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isString('assetData', assetData); + assert.isBigNumber('amount', amount); + const self = (this as any) as ForwarderContract; + const encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData, amount]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.withdrawAsset.estimateGasAsync.bind(self, assetData, amount), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( assetData: string, @@ -283,57 +456,52 @@ export class ForwarderContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('assetData', assetData); - assert.isBigNumber('amount', amount); - const self = this as any as ForwarderContract; - const txHashPromise = self.withdrawAsset.sendTransactionAsync(assetData, - amount - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('assetData', assetData); + assert.isBigNumber('amount', amount); + const self = (this as any) as ForwarderContract; + const txHashPromise = self.withdrawAsset.sendTransactionAsync(assetData, amount, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( assetData: string, amount: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('assetData', assetData); - assert.isBigNumber('amount', amount); - const self = this as any as ForwarderContract; - const encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData, - amount - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('assetData', assetData); + assert.isBigNumber('amount', amount); + const self = (this as any) as ForwarderContract; + const encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData, amount]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( assetData: string, amount: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('assetData', assetData); assert.isBigNumber('amount', amount); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -344,10 +512,8 @@ export class ForwarderContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ForwarderContract; - const encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData, - amount - ]); + const self = (this as any) as ForwarderContract; + const encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData, amount]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -356,36 +522,31 @@ export class ForwarderContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('withdrawAsset(bytes,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - assetData: string, - amount: BigNumber, - ): string { + getABIEncodedTransactionData(assetData: string, amount: BigNumber): string { assert.isString('assetData', assetData); assert.isBigNumber('amount', amount); - const self = this as any as ForwarderContract; - const abiEncodedTransactionData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData, - amount - ]); + const self = (this as any) as ForwarderContract; + const abiEncodedTransactionData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [ + assetData, + amount, + ]); return abiEncodedTransactionData; }, }; public owner = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -394,7 +555,7 @@ export class ForwarderContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ForwarderContract; + const self = (this as any) as ForwarderContract; const encodedData = self._strictEncodeArguments('owner()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -404,76 +565,125 @@ export class ForwarderContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as ForwarderContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as ForwarderContract; const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); return abiEncodedTransactionData; }, }; public marketSellOrdersWithEth = { async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, signatures: string[], - feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + feeOrders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, feeSignatures: string[], feePercentage: BigNumber, feeRecipient: string, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isArray('signatures', signatures); - assert.isArray('feeOrders', feeOrders); - assert.isArray('feeSignatures', feeSignatures); - assert.isBigNumber('feePercentage', feePercentage); - assert.isString('feeRecipient', feeRecipient); - const self = this as any as ForwarderContract; - const encodedData = self._strictEncodeArguments('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.marketSellOrdersWithEth.estimateGasAsync.bind( - self, - orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isArray('orders', orders); + assert.isArray('signatures', signatures); + assert.isArray('feeOrders', feeOrders); + assert.isArray('feeSignatures', feeSignatures); + assert.isBigNumber('feePercentage', feePercentage); + assert.isString('feeRecipient', feeRecipient); + const self = (this as any) as ForwarderContract; + const encodedData = self._strictEncodeArguments( + 'marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', + [orders, signatures, feeOrders, feeSignatures, feePercentage, feeRecipient.toLowerCase()], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.marketSellOrdersWithEth.estimateGasAsync.bind( + self, + orders, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase(), + ), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, signatures: string[], - feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + feeOrders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, feeSignatures: string[], feePercentage: BigNumber, feeRecipient: string, @@ -481,80 +691,145 @@ export class ForwarderContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isArray('orders', orders); - assert.isArray('signatures', signatures); - assert.isArray('feeOrders', feeOrders); - assert.isArray('feeSignatures', feeSignatures); - assert.isBigNumber('feePercentage', feePercentage); - assert.isString('feeRecipient', feeRecipient); - const self = this as any as ForwarderContract; - const txHashPromise = self.marketSellOrdersWithEth.sendTransactionAsync(orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isArray('orders', orders); + assert.isArray('signatures', signatures); + assert.isArray('feeOrders', feeOrders); + assert.isArray('feeSignatures', feeSignatures); + assert.isBigNumber('feePercentage', feePercentage); + assert.isString('feeRecipient', feeRecipient); + const self = (this as any) as ForwarderContract; + const txHashPromise = self.marketSellOrdersWithEth.sendTransactionAsync( + orders, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient.toLowerCase(), + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, signatures: string[], - feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + feeOrders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, feeSignatures: string[], feePercentage: BigNumber, feeRecipient: string, txData?: Partial | undefined, ): Promise { - assert.isArray('orders', orders); - assert.isArray('signatures', signatures); - assert.isArray('feeOrders', feeOrders); - assert.isArray('feeSignatures', feeSignatures); - assert.isBigNumber('feePercentage', feePercentage); - assert.isString('feeRecipient', feeRecipient); - const self = this as any as ForwarderContract; - const encodedData = self._strictEncodeArguments('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isArray('orders', orders); + assert.isArray('signatures', signatures); + assert.isArray('feeOrders', feeOrders); + assert.isArray('feeSignatures', feeSignatures); + assert.isBigNumber('feePercentage', feePercentage); + assert.isString('feeRecipient', feeRecipient); + const self = (this as any) as ForwarderContract; + const encodedData = self._strictEncodeArguments( + 'marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', + [orders, signatures, feeOrders, feeSignatures, feePercentage, feeRecipient.toLowerCase()], + ); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, signatures: string[], - feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + feeOrders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, feeSignatures: string[], feePercentage: BigNumber, feeRecipient: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}] + ): Promise< + [ + { + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }, + { + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + } + ] > { assert.isArray('orders', orders); assert.isArray('signatures', signatures); @@ -570,14 +845,11 @@ export class ForwarderContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ForwarderContract; - const encodedData = self._strictEncodeArguments('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase() - ]); + const self = (this as any) as ForwarderContract; + const encodedData = self._strictEncodeArguments( + 'marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', + [orders, signatures, feeOrders, feeSignatures, feePercentage, feeRecipient.toLowerCase()], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -586,69 +858,103 @@ export class ForwarderContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(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)'); + const abiEncoder = self._lookupAbiEncoder( + 'marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}] - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue< + [ + { + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + }, + { + makerAssetFilledAmount: BigNumber; + takerAssetFilledAmount: BigNumber; + makerFeePaid: BigNumber; + takerFeePaid: BigNumber; + } + ] + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - signatures: string[], - feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - feeSignatures: string[], - feePercentage: BigNumber, - feeRecipient: string, - ): string { + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, + signatures: string[], + feeOrders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, + feeSignatures: string[], + feePercentage: BigNumber, + feeRecipient: string, + ): string { assert.isArray('orders', orders); assert.isArray('signatures', signatures); assert.isArray('feeOrders', feeOrders); assert.isArray('feeSignatures', feeSignatures); assert.isBigNumber('feePercentage', feePercentage); assert.isString('feeRecipient', feeRecipient); - const self = this as any as ForwarderContract; - const abiEncodedTransactionData = self._strictEncodeArguments('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient.toLowerCase() - ]); + const self = (this as any) as ForwarderContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', + [orders, signatures, feeOrders, feeSignatures, feePercentage, feeRecipient.toLowerCase()], + ); return abiEncodedTransactionData; }, }; public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('newOwner', newOwner); - const self = this as any as ForwarderContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind( - self, - newOwner.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as ForwarderContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( newOwner: string, @@ -656,51 +962,41 @@ export class ForwarderContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('newOwner', newOwner); - const self = this as any as ForwarderContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('newOwner', newOwner); + const self = (this as any) as ForwarderContract; + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - newOwner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('newOwner', newOwner); - const self = this as any as ForwarderContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as ForwarderContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - newOwner: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -710,9 +1006,8 @@ export class ForwarderContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ForwarderContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); + const self = (this as any) as ForwarderContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -721,35 +1016,35 @@ export class ForwarderContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - newOwner: string, - ): string { + getABIEncodedTransactionData(newOwner: string): string { assert.isString('newOwner', newOwner); - const self = this as any as ForwarderContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); + const self = (this as any) as ForwarderContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ + newOwner.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; -public static async deployFrom0xArtifactAsync( + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, - _exchange: string, - _zrxAssetData: string, - _wethAssetData: string, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + _exchange: string, + _zrxAssetData: string, + _wethAssetData: string, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -762,11 +1057,20 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); - return ForwarderContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, _exchange, -_zrxAssetData, -_wethAssetData -); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, + ); + return ForwarderContract.deployAsync( + bytecode, + abi, + provider, + txDefaults, + logDecodeDependenciesAbiOnly, + _exchange, + _zrxAssetData, + _wethAssetData, + ); } public static async deployAsync( bytecode: string, @@ -774,9 +1078,9 @@ _wethAssetData supportedProvider: SupportedProvider, txDefaults: Partial, logDecodeDependencies: { [contractName: string]: ContractAbi }, - _exchange: string, - _zrxAssetData: string, - _wethAssetData: string, + _exchange: string, + _zrxAssetData: string, + _wethAssetData: string, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -786,26 +1090,17 @@ _wethAssetData ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_exchange, -_zrxAssetData, -_wethAssetData -] = BaseContract._formatABIDataItemList( + [_exchange, _zrxAssetData, _wethAssetData] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [_exchange, -_zrxAssetData, -_wethAssetData -], + [_exchange, _zrxAssetData, _wethAssetData], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_exchange, -_zrxAssetData, -_wethAssetData -]); + const txData = deployInfo.encode(bytecode, [_exchange, _zrxAssetData, _wethAssetData]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -813,21 +1108,22 @@ _wethAssetData logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`Forwarder successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ForwarderContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); - contractInstance.constructorArgs = [_exchange, -_zrxAssetData, -_wethAssetData -]; + const contractInstance = new ForwarderContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + logDecodeDependencies, + ); + contractInstance.constructorArgs = [_exchange, _zrxAssetData, _wethAssetData]; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: false, inputs: [ { @@ -882,7 +1178,7 @@ _wethAssetData name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'makerAssetFillAmount', @@ -944,7 +1240,7 @@ _wethAssetData name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'feeSignatures', @@ -981,7 +1277,7 @@ _wethAssetData name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, { name: 'feeOrderFillResults', @@ -1003,14 +1299,14 @@ _wethAssetData name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, ], payable: true, stateMutability: 'payable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1023,16 +1319,14 @@ _wethAssetData }, ], name: 'withdrawAsset', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'owner', outputs: [ { @@ -1044,7 +1338,7 @@ _wethAssetData stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1099,7 +1393,7 @@ _wethAssetData name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'signatures', @@ -1157,7 +1451,7 @@ _wethAssetData name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'feeSignatures', @@ -1194,7 +1488,7 @@ _wethAssetData name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, { name: 'feeOrderFillResults', @@ -1216,14 +1510,14 @@ _wethAssetData name: 'takerFeePaid', type: 'uint256', }, - ] + ], }, ], payable: true, stateMutability: 'payable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1232,13 +1526,12 @@ _wethAssetData }, ], name: 'transferOwnership', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { inputs: [ { name: '_exchange', @@ -1253,17 +1546,14 @@ _wethAssetData type: 'bytes', }, ], - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'constructor', }, - { - inputs: [ - ], - outputs: [ - ], + { + inputs: [], + outputs: [], payable: true, stateMutability: 'payable', type: 'fallback', @@ -1271,11 +1561,16 @@ _wethAssetData ] as ContractAbi; return abi; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { super('Forwarder', ForwarderContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 0f9485156a..13b92cc118 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 @@ -1,7 +1,7 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract,PromiseWithTransactionHash } from '@0x/base-contract'; +import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -23,38 +23,30 @@ import { assert } from '@0x/assert'; import * as ethers from 'ethers'; // tslint:enable:no-unused-variable - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class IAssetProxyContract extends BaseContract { public addAuthorizedAddress = { - async sendTransactionAsync( - target: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('target', target); - const self = this as any as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.addAuthorizedAddress.estimateGasAsync.bind( - self, - target.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.addAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -62,51 +54,41 @@ export class IAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = this as any as IAssetProxyContract; - const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + const self = (this as any) as IAssetProxyContract; + const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - target: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('target', target); - const self = this as any as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - target: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('target', target); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -116,9 +98,8 @@ export class IAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() - ]); + const self = (this as any) as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -127,54 +108,47 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - target: string, - ): string { + getABIEncodedTransactionData(target: string): string { assert.isString('target', target); - const self = this as any as IAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() - ]); + const self = (this as any) as IAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [ + target.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public removeAuthorizedAddress = { - async sendTransactionAsync( - target: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('target', target); - const self = this as any as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddress.estimateGasAsync.bind( - self, - target.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -182,51 +156,41 @@ export class IAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = this as any as IAssetProxyContract; - const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + const self = (this as any) as IAssetProxyContract; + const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - target: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('target', target); - const self = this as any as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - target: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('target', target); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -236,9 +200,8 @@ export class IAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() - ]); + const self = (this as any) as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -247,24 +210,24 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - target: string, - ): string { + getABIEncodedTransactionData(target: string): string { assert.isString('target', target); - const self = this as any as IAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() - ]); + const self = (this as any) as IAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [ + target.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; @@ -272,33 +235,30 @@ export class IAssetProxyContract extends BaseContract { async sendTransactionAsync( target: string, index: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = this as any as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), - index - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind( - self, + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ target.toLowerCase(), - index - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + index, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(self, target.toLowerCase(), index), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -307,57 +267,59 @@ export class IAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = this as any as IAssetProxyContract; - const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync(target.toLowerCase(), - index - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as IAssetProxyContract; + const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync( + target.toLowerCase(), + index, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( target: string, index: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = this as any as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), - index - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ + target.toLowerCase(), + index, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( target: string, index: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('target', target); assert.isBigNumber('index', index); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -368,10 +330,11 @@ export class IAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), - index - ]); + const self = (this as any) as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ + target.toLowerCase(), + index, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -380,27 +343,26 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - target: string, - index: BigNumber, - ): string { + getABIEncodedTransactionData(target: string, index: BigNumber): string { assert.isString('target', target); assert.isBigNumber('index', index); - const self = this as any as IAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), - index - ]); + const self = (this as any) as IAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'removeAuthorizedAddressAtIndex(address,uint256)', + [target.toLowerCase(), index], + ); return abiEncodedTransactionData; }, }; @@ -410,39 +372,34 @@ export class IAssetProxyContract extends BaseContract { from: string, to: string, amount: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('assetData', assetData); - assert.isString('from', from); - assert.isString('to', to); - assert.isBigNumber('amount', amount); - const self = this as any as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [assetData, - from.toLowerCase(), - to.toLowerCase(), - amount - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind( - self, + assert.isString('assetData', assetData); + assert.isString('from', from); + assert.isString('to', to); + assert.isBigNumber('amount', amount); + const self = (this as any) as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [ assetData, from.toLowerCase(), to.toLowerCase(), - amount - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + amount, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferFrom.estimateGasAsync.bind(self, assetData, from.toLowerCase(), to.toLowerCase(), amount), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( assetData: string, @@ -453,27 +410,29 @@ export class IAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('assetData', assetData); - assert.isString('from', from); - assert.isString('to', to); - assert.isBigNumber('amount', amount); - const self = this as any as IAssetProxyContract; - const txHashPromise = self.transferFrom.sendTransactionAsync(assetData, - from.toLowerCase(), - to.toLowerCase(), - amount - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('assetData', assetData); + assert.isString('from', from); + assert.isString('to', to); + assert.isBigNumber('amount', amount); + const self = (this as any) as IAssetProxyContract; + const txHashPromise = self.transferFrom.sendTransactionAsync( + assetData, + from.toLowerCase(), + to.toLowerCase(), + amount, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( assetData: string, @@ -482,30 +441,31 @@ export class IAssetProxyContract extends BaseContract { amount: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('assetData', assetData); - assert.isString('from', from); - assert.isString('to', to); - assert.isBigNumber('amount', amount); - const self = this as any as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [assetData, - from.toLowerCase(), - to.toLowerCase(), - amount - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('assetData', assetData); + assert.isString('from', from); + assert.isString('to', to); + assert.isBigNumber('amount', amount); + const self = (this as any) as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [ + assetData, + from.toLowerCase(), + to.toLowerCase(), + amount, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( assetData: string, @@ -514,8 +474,7 @@ export class IAssetProxyContract extends BaseContract { amount: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('assetData', assetData); assert.isString('from', from); assert.isString('to', to); @@ -528,12 +487,13 @@ export class IAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [assetData, - from.toLowerCase(), - to.toLowerCase(), - amount - ]); + const self = (this as any) as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [ + assetData, + from.toLowerCase(), + to.toLowerCase(), + amount, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -542,42 +502,33 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(bytes,address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - assetData: string, - from: string, - to: string, - amount: BigNumber, - ): string { + getABIEncodedTransactionData(assetData: string, from: string, to: string, amount: BigNumber): string { assert.isString('assetData', assetData); assert.isString('from', from); assert.isString('to', to); assert.isBigNumber('amount', amount); - const self = this as any as IAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [assetData, - from.toLowerCase(), - to.toLowerCase(), - amount - ]); + const self = (this as any) as IAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'transferFrom(bytes,address,address,uint256)', + [assetData, from.toLowerCase(), to.toLowerCase(), amount], + ); return abiEncodedTransactionData; }, }; public getProxyId = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -586,7 +537,7 @@ export class IAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as IAssetProxyContract; + const self = (this as any) as IAssetProxyContract; const encodedData = self._strictEncodeArguments('getProxyId()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -596,30 +547,26 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getProxyId()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as IAssetProxyContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as IAssetProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('getProxyId()', []); return abiEncodedTransactionData; }, }; public getAuthorizedAddresses = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -628,7 +575,7 @@ export class IAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as IAssetProxyContract; + const self = (this as any) as IAssetProxyContract; const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -638,51 +585,44 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as IAssetProxyContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as IAssetProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('getAuthorizedAddresses()', []); return abiEncodedTransactionData; }, }; public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('newOwner', newOwner); - const self = this as any as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind( - self, - newOwner.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( newOwner: string, @@ -690,51 +630,41 @@ export class IAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('newOwner', newOwner); - const self = this as any as IAssetProxyContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('newOwner', newOwner); + const self = (this as any) as IAssetProxyContract; + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - newOwner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('newOwner', newOwner); - const self = this as any as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - newOwner: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -744,9 +674,8 @@ export class IAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as IAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); + const self = (this as any) as IAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -755,32 +684,32 @@ export class IAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - newOwner: string, - ): string { + getABIEncodedTransactionData(newOwner: string): string { assert.isString('newOwner', newOwner); - const self = this as any as IAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); + const self = (this as any) as IAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ + newOwner.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; -public static async deployFrom0xArtifactAsync( + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -793,8 +722,11 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); - return IAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, + ); + return IAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( bytecode: string, @@ -811,17 +743,13 @@ public static async deployFrom0xArtifactAsync( ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); + [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -829,18 +757,22 @@ public static async deployFrom0xArtifactAsync( logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`IAssetProxy successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new IAssetProxyContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); + const contractInstance = new IAssetProxyContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + logDecodeDependencies, + ); contractInstance.constructorArgs = []; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: false, inputs: [ { @@ -849,13 +781,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'addAuthorizedAddress', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -864,13 +795,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'removeAuthorizedAddress', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -883,13 +813,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'removeAuthorizedAddressAtIndex', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -910,16 +839,14 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'transferFrom', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'getProxyId', outputs: [ { @@ -931,10 +858,9 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'pure', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'getAuthorizedAddresses', outputs: [ { @@ -946,7 +872,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -955,8 +881,7 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'transferOwnership', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', @@ -964,11 +889,16 @@ public static async deployFrom0xArtifactAsync( ] as ContractAbi; return abi; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { super('IAssetProxy', IAssetProxyContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 a579445d03..fd016262d4 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts @@ -1,7 +1,7 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract,PromiseWithTransactionHash } from '@0x/base-contract'; +import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -23,7 +23,6 @@ import { assert } from '@0x/assert'; import * as ethers from 'ethers'; // tslint:enable:no-unused-variable - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name @@ -35,8 +34,7 @@ export class IValidatorContract extends BaseContract { signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('hash', hash); assert.isString('signerAddress', signerAddress); assert.isString('signature', signature); @@ -48,11 +46,12 @@ export class IValidatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as IValidatorContract; - const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [hash, - signerAddress.toLowerCase(), - signature - ]); + const self = (this as any) as IValidatorContract; + const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [ + hash, + signerAddress.toLowerCase(), + signature, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -61,38 +60,36 @@ export class IValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isValidSignature(bytes32,address,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - hash: string, - signerAddress: string, - signature: string, - ): string { + getABIEncodedTransactionData(hash: string, signerAddress: string, signature: string): string { assert.isString('hash', hash); assert.isString('signerAddress', signerAddress); assert.isString('signature', signature); - const self = this as any as IValidatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [hash, - signerAddress.toLowerCase(), - signature - ]); + const self = (this as any) as IValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [ + hash, + signerAddress.toLowerCase(), + signature, + ]); return abiEncodedTransactionData; }, }; -public static async deployFrom0xArtifactAsync( + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -105,8 +102,11 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); - return IValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, + ); + return IValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( bytecode: string, @@ -123,17 +123,13 @@ public static async deployFrom0xArtifactAsync( ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); + [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -141,18 +137,22 @@ public static async deployFrom0xArtifactAsync( logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`IValidator successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new IValidatorContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); + const contractInstance = new IValidatorContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + logDecodeDependencies, + ); contractInstance.constructorArgs = []; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -182,11 +182,16 @@ public static async deployFrom0xArtifactAsync( ] as ContractAbi; return abi; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { super('IValidator', IValidatorContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 df213acdc8..20a8250ba8 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts @@ -1,7 +1,7 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract,PromiseWithTransactionHash } from '@0x/base-contract'; +import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -23,7 +23,6 @@ import { assert } from '@0x/assert'; import * as ethers from 'ethers'; // tslint:enable:no-unused-variable - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name @@ -34,8 +33,7 @@ export class IWalletContract extends BaseContract { signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('hash', hash); assert.isString('signature', signature); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -46,10 +44,8 @@ export class IWalletContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as IWalletContract; - const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,bytes)', [hash, - signature - ]); + const self = (this as any) as IWalletContract; + const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,bytes)', [hash, signature]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -58,35 +54,34 @@ export class IWalletContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isValidSignature(bytes32,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - hash: string, - signature: string, - ): string { + getABIEncodedTransactionData(hash: string, signature: string): string { assert.isString('hash', hash); assert.isString('signature', signature); - const self = this as any as IWalletContract; - const abiEncodedTransactionData = self._strictEncodeArguments('isValidSignature(bytes32,bytes)', [hash, - signature - ]); + const self = (this as any) as IWalletContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isValidSignature(bytes32,bytes)', [ + hash, + signature, + ]); return abiEncodedTransactionData; }, }; -public static async deployFrom0xArtifactAsync( + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -99,8 +94,11 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); - return IWalletContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, + ); + return IWalletContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( bytecode: string, @@ -117,17 +115,13 @@ public static async deployFrom0xArtifactAsync( ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); + [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -135,18 +129,22 @@ public static async deployFrom0xArtifactAsync( logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`IWallet successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new IWalletContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); + const contractInstance = new IWalletContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + logDecodeDependencies, + ); contractInstance.constructorArgs = []; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -172,11 +170,16 @@ public static async deployFrom0xArtifactAsync( ] as ContractAbi; return abi; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { super('IWallet', IWalletContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 47aca21b22..92628c0c03 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 @@ -1,11 +1,14 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, +import { + BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; + SubscriptionManager, + PromiseWithTransactionHash, +} from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -54,18 +57,12 @@ export interface MultiAssetProxyAssetProxyRegisteredEventArgs extends DecodedLog assetProxy: string; } - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class MultiAssetProxyContract extends BaseContract { public assetProxies = { - async callAsync( - index_0: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(index_0: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -75,9 +72,8 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0 - ]); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -86,54 +82,45 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('assetProxies(bytes4)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: string, - ): string { + getABIEncodedTransactionData(index_0: string): string { assert.isString('index_0', index_0); - const self = this as any as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0 - ]); + const self = (this as any) as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0]); return abiEncodedTransactionData; }, }; public addAuthorizedAddress = { - async sendTransactionAsync( - target: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('target', target); - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.addAuthorizedAddress.estimateGasAsync.bind( - self, - target.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.addAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -141,51 +128,41 @@ export class MultiAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = this as any as MultiAssetProxyContract; - const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + const self = (this as any) as MultiAssetProxyContract; + const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - target: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('target', target); - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - target: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('target', target); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -195,9 +172,8 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() - ]); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -206,24 +182,24 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - target: string, - ): string { + getABIEncodedTransactionData(target: string): string { assert.isString('target', target); - const self = this as any as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase() - ]); + const self = (this as any) as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [ + target.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; @@ -232,8 +208,7 @@ export class MultiAssetProxyContract extends BaseContract { index_0: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isBigNumber('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -243,9 +218,8 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0 - ]); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -254,24 +228,22 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: BigNumber, - ): string { + getABIEncodedTransactionData(index_0: BigNumber): string { assert.isBigNumber('index_0', index_0); - const self = this as any as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('authorities(uint256)', [index_0 - ]); + const self = (this as any) as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('authorities(uint256)', [index_0]); return abiEncodedTransactionData; }, }; @@ -280,8 +252,7 @@ export class MultiAssetProxyContract extends BaseContract { assetProxyId: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('assetProxyId', assetProxyId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -291,9 +262,8 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId - ]); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -302,54 +272,45 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAssetProxy(bytes4)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - assetProxyId: string, - ): string { + getABIEncodedTransactionData(assetProxyId: string): string { assert.isString('assetProxyId', assetProxyId); - const self = this as any as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId - ]); + const self = (this as any) as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId]); return abiEncodedTransactionData; }, }; public removeAuthorizedAddress = { - async sendTransactionAsync( - target: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('target', target); - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddress.estimateGasAsync.bind( - self, - target.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeAuthorizedAddress.estimateGasAsync.bind(self, target.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -357,51 +318,41 @@ export class MultiAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - const self = this as any as MultiAssetProxyContract; - const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + const self = (this as any) as MultiAssetProxyContract; + const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - target: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('target', target); - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(target: string, txData?: Partial | undefined): Promise { + assert.isString('target', target); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - target: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(target: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('target', target); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -411,9 +362,8 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() - ]); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -422,33 +372,29 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - target: string, - ): string { + getABIEncodedTransactionData(target: string): string { assert.isString('target', target); - const self = this as any as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase() - ]); + const self = (this as any) as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [ + target.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public owner = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -457,7 +403,7 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as MultiAssetProxyContract; + const self = (this as any) as MultiAssetProxyContract; const encodedData = self._strictEncodeArguments('owner()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -467,20 +413,20 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as MultiAssetProxyContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as MultiAssetProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); return abiEncodedTransactionData; }, @@ -489,33 +435,30 @@ export class MultiAssetProxyContract extends BaseContract { async sendTransactionAsync( target: string, index: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), - index - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind( - self, + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ target.toLowerCase(), - index - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + index, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(self, target.toLowerCase(), index), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( target: string, @@ -524,57 +467,59 @@ export class MultiAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = this as any as MultiAssetProxyContract; - const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync(target.toLowerCase(), - index - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as MultiAssetProxyContract; + const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync( + target.toLowerCase(), + index, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( target: string, index: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), - index - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ + target.toLowerCase(), + index, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( target: string, index: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('target', target); assert.isBigNumber('index', index); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -585,10 +530,11 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), - index - ]); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [ + target.toLowerCase(), + index, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -597,36 +543,31 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - target: string, - index: BigNumber, - ): string { + getABIEncodedTransactionData(target: string, index: BigNumber): string { assert.isString('target', target); assert.isBigNumber('index', index); - const self = this as any as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target.toLowerCase(), - index - ]); + const self = (this as any) as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'removeAuthorizedAddressAtIndex(address,uint256)', + [target.toLowerCase(), index], + ); return abiEncodedTransactionData; }, }; public getProxyId = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -635,7 +576,7 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as MultiAssetProxyContract; + const self = (this as any) as MultiAssetProxyContract; const encodedData = self._strictEncodeArguments('getProxyId()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -645,20 +586,20 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getProxyId()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as MultiAssetProxyContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as MultiAssetProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('getProxyId()', []); return abiEncodedTransactionData; }, @@ -668,8 +609,7 @@ export class MultiAssetProxyContract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -679,9 +619,8 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase() - ]); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -690,54 +629,47 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorized(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: string, - ): string { + getABIEncodedTransactionData(index_0: string): string { assert.isString('index_0', index_0); - const self = this as any as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [index_0.toLowerCase() - ]); + const self = (this as any) as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [ + index_0.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public registerAssetProxy = { - async sendTransactionAsync( - assetProxy: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('assetProxy', assetProxy); - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.registerAssetProxy.estimateGasAsync.bind( - self, - assetProxy.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(assetProxy: string, txData?: Partial | undefined): Promise { + assert.isString('assetProxy', assetProxy); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.registerAssetProxy.estimateGasAsync.bind(self, assetProxy.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( assetProxy: string, @@ -745,51 +677,45 @@ export class MultiAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('assetProxy', assetProxy); - const self = this as any as MultiAssetProxyContract; - const txHashPromise = self.registerAssetProxy.sendTransactionAsync(assetProxy.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('assetProxy', assetProxy); + const self = (this as any) as MultiAssetProxyContract; + const txHashPromise = self.registerAssetProxy.sendTransactionAsync(assetProxy.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - assetProxy: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('assetProxy', assetProxy); - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(assetProxy: string, txData?: Partial | undefined): Promise { + assert.isString('assetProxy', assetProxy); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( assetProxy: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('assetProxy', assetProxy); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -799,9 +725,8 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase() - ]); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -810,33 +735,29 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - assetProxy: string, - ): string { + getABIEncodedTransactionData(assetProxy: string): string { assert.isString('assetProxy', assetProxy); - const self = this as any as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase() - ]); + const self = (this as any) as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address)', [ + assetProxy.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public getAuthorizedAddresses = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -845,7 +766,7 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as MultiAssetProxyContract; + const self = (this as any) as MultiAssetProxyContract; const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -855,51 +776,44 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as MultiAssetProxyContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as MultiAssetProxyContract; const abiEncodedTransactionData = self._strictEncodeArguments('getAuthorizedAddresses()', []); return abiEncodedTransactionData; }, }; public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('newOwner', newOwner); - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind( - self, - newOwner.toLowerCase() - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferOwnership.estimateGasAsync.bind(self, newOwner.toLowerCase()), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( newOwner: string, @@ -907,51 +821,41 @@ export class MultiAssetProxyContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('newOwner', newOwner); - const self = this as any as MultiAssetProxyContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase() - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('newOwner', newOwner); + const self = (this as any) as MultiAssetProxyContract; + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - newOwner: string, - txData?: Partial | undefined, - ): Promise { - assert.isString('newOwner', newOwner); - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(newOwner: string, txData?: Partial | undefined): Promise { + assert.isString('newOwner', newOwner); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - newOwner: string, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(newOwner: string, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isString('newOwner', newOwner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -961,9 +865,8 @@ export class MultiAssetProxyContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); + const self = (this as any) as MultiAssetProxyContract; + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -972,33 +875,33 @@ export class MultiAssetProxyContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - newOwner: string, - ): string { + getABIEncodedTransactionData(newOwner: string): string { assert.isString('newOwner', newOwner); - const self = this as any as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase() - ]); + const self = (this as any) as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [ + newOwner.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; -private readonly _subscriptionManager: SubscriptionManager; -public static async deployFrom0xArtifactAsync( + private readonly _subscriptionManager: SubscriptionManager; + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -1011,8 +914,11 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); - return MultiAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, + ); + return MultiAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( bytecode: string, @@ -1029,17 +935,13 @@ public static async deployFrom0xArtifactAsync( ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); + [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -1047,18 +949,22 @@ public static async deployFrom0xArtifactAsync( logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`MultiAssetProxy successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new MultiAssetProxyContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); + const contractInstance = new MultiAssetProxyContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + logDecodeDependencies, + ); contractInstance.constructorArgs = []; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -1077,7 +983,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1086,13 +992,12 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'addAuthorizedAddress', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1111,7 +1016,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1130,7 +1035,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1139,16 +1044,14 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'removeAuthorizedAddress', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'owner', outputs: [ { @@ -1160,7 +1063,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1173,16 +1076,14 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'removeAuthorizedAddressAtIndex', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'getProxyId', outputs: [ { @@ -1194,7 +1095,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'pure', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1213,7 +1114,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1222,16 +1123,14 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'registerAssetProxy', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'getAuthorizedAddresses', outputs: [ { @@ -1243,7 +1142,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1252,22 +1151,19 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'transferOwnership', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { - inputs: [ - ], - outputs: [ - ], + { + inputs: [], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'fallback', }, - { + { anonymous: false, inputs: [ { @@ -1282,11 +1178,10 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'AuthorizedAddressAdded', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1301,11 +1196,10 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'AuthorizedAddressRemoved', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1320,8 +1214,7 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'AssetProxyRegistered', - outputs: [ - ], + outputs: [], type: 'event', }, ] as ContractAbi; @@ -1395,15 +1288,27 @@ public static async deployFrom0xArtifactAsync( ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { - super('MultiAssetProxy', MultiAssetProxyContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { + super( + 'MultiAssetProxy', + MultiAssetProxyContract.ABI(), + address, + supportedProvider, + txDefaults, + logDecodeDependencies, + ); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( MultiAssetProxyContract.ABI(), this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 3f2843d6ed..2183ee494f 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts @@ -1,7 +1,7 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract,PromiseWithTransactionHash } from '@0x/base-contract'; +import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -23,20 +23,44 @@ import { assert } from '@0x/assert'; import * as ethers from 'ethers'; // tslint:enable:no-unused-variable - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class OrderValidatorContract extends BaseContract { public getOrderAndTraderInfo = { async callAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, takerAddress: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<[{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}, {makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}] + ): Promise< + [ + { orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }, + { + makerBalance: BigNumber; + makerAllowance: BigNumber; + takerBalance: BigNumber; + takerAllowance: BigNumber; + makerZrxBalance: BigNumber; + makerZrxAllowance: BigNumber; + takerZrxBalance: BigNumber; + takerZrxAllowance: BigNumber; + } + ] > { - assert.isString('takerAddress', takerAddress); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -46,10 +70,11 @@ export class OrderValidatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as OrderValidatorContract; - const encodedData = self._strictEncodeArguments('getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', [order, - takerAddress.toLowerCase() - ]); + const self = (this as any) as OrderValidatorContract; + const encodedData = self._strictEncodeArguments( + 'getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', + [order, takerAddress.toLowerCase()], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -58,27 +83,57 @@ export class OrderValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)'); + const abiEncoder = self._lookupAbiEncoder( + 'getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<[{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}, {makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}] - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue< + [ + { orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }, + { + makerBalance: BigNumber; + makerAllowance: BigNumber; + takerBalance: BigNumber; + takerAllowance: BigNumber; + makerZrxBalance: BigNumber; + makerZrxAllowance: BigNumber; + takerZrxBalance: BigNumber; + takerZrxAllowance: BigNumber; + } + ] + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAddress: string, - ): string { - + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, + takerAddress: string, + ): string { assert.isString('takerAddress', takerAddress); - const self = this as any as OrderValidatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', [order, - takerAddress.toLowerCase() - ]); + const self = (this as any) as OrderValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', + [order, takerAddress.toLowerCase()], + ); return abiEncodedTransactionData; }, }; @@ -88,8 +143,7 @@ export class OrderValidatorContract extends BaseContract { assetData: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<[BigNumber, BigNumber] - > { + ): Promise<[BigNumber, BigNumber]> { assert.isString('target', target); assert.isString('assetData', assetData); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -100,10 +154,11 @@ export class OrderValidatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as OrderValidatorContract; - const encodedData = self._strictEncodeArguments('getBalanceAndAllowance(address,bytes)', [target.toLowerCase(), - assetData - ]); + const self = (this as any) as OrderValidatorContract; + const encodedData = self._strictEncodeArguments('getBalanceAndAllowance(address,bytes)', [ + target.toLowerCase(), + assetData, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -112,37 +167,62 @@ export class OrderValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getBalanceAndAllowance(address,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<[BigNumber, BigNumber] - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<[BigNumber, BigNumber]>(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - target: string, - assetData: string, - ): string { + getABIEncodedTransactionData(target: string, assetData: string): string { assert.isString('target', target); assert.isString('assetData', assetData); - const self = this as any as OrderValidatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getBalanceAndAllowance(address,bytes)', [target.toLowerCase(), - assetData - ]); + const self = (this as any) as OrderValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getBalanceAndAllowance(address,bytes)', [ + target.toLowerCase(), + assetData, + ]); return abiEncodedTransactionData; }, }; public getOrdersAndTradersInfo = { async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAddresses: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<[Array<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}>, Array<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}>] + ): Promise< + [ + Array<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }>, + Array<{ + makerBalance: BigNumber; + makerAllowance: BigNumber; + takerBalance: BigNumber; + takerAllowance: BigNumber; + makerZrxBalance: BigNumber; + makerZrxAllowance: BigNumber; + takerZrxBalance: BigNumber; + takerZrxAllowance: BigNumber; + }> + ] > { assert.isArray('orders', orders); assert.isArray('takerAddresses', takerAddresses); @@ -154,10 +234,11 @@ export class OrderValidatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as OrderValidatorContract; - const encodedData = self._strictEncodeArguments('getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', [orders, - takerAddresses - ]); + const self = (this as any) as OrderValidatorContract; + const encodedData = self._strictEncodeArguments( + 'getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', + [orders, takerAddresses], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -166,37 +247,91 @@ export class OrderValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])'); + const abiEncoder = self._lookupAbiEncoder( + 'getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<[Array<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}>, Array<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}>] - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue< + [ + Array<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }>, + Array<{ + makerBalance: BigNumber; + makerAllowance: BigNumber; + takerBalance: BigNumber; + takerAllowance: BigNumber; + makerZrxBalance: BigNumber; + makerZrxAllowance: BigNumber; + takerZrxBalance: BigNumber; + takerZrxAllowance: BigNumber; + }> + ] + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAddresses: string[], - ): string { + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, + takerAddresses: string[], + ): string { assert.isArray('orders', orders); assert.isArray('takerAddresses', takerAddresses); - const self = this as any as OrderValidatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', [orders, - takerAddresses - ]); + const self = (this as any) as OrderValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', + [orders, takerAddresses], + ); return abiEncodedTransactionData; }, }; public getTradersInfo = { async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, takerAddresses: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise + ): Promise< + Array<{ + makerBalance: BigNumber; + makerAllowance: BigNumber; + takerBalance: BigNumber; + takerAllowance: BigNumber; + makerZrxBalance: BigNumber; + makerZrxAllowance: BigNumber; + takerZrxBalance: BigNumber; + takerZrxAllowance: BigNumber; + }> > { assert.isArray('orders', orders); assert.isArray('takerAddresses', takerAddresses); @@ -208,10 +343,11 @@ export class OrderValidatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as OrderValidatorContract; - const encodedData = self._strictEncodeArguments('getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', [orders, - takerAddresses - ]); + const self = (this as any) as OrderValidatorContract; + const encodedData = self._strictEncodeArguments( + 'getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', + [orders, takerAddresses], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -220,27 +356,55 @@ export class OrderValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])'); + const abiEncoder = self._lookupAbiEncoder( + 'getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue< + Array<{ + makerBalance: BigNumber; + makerAllowance: BigNumber; + takerBalance: BigNumber; + takerAllowance: BigNumber; + makerZrxBalance: BigNumber; + makerZrxAllowance: BigNumber; + takerZrxBalance: BigNumber; + takerZrxAllowance: BigNumber; + }> + >(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAddresses: string[], - ): string { + orders: Array<{ + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }>, + takerAddresses: string[], + ): string { assert.isArray('orders', orders); assert.isArray('takerAddresses', takerAddresses); - const self = this as any as OrderValidatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', [orders, - takerAddresses - ]); + const self = (this as any) as OrderValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', + [orders, takerAddresses], + ); return abiEncodedTransactionData; }, }; @@ -250,8 +414,7 @@ export class OrderValidatorContract extends BaseContract { tokenId: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('token', token); assert.isBigNumber('tokenId', tokenId); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -262,10 +425,11 @@ export class OrderValidatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as OrderValidatorContract; - const encodedData = self._strictEncodeArguments('getERC721TokenOwner(address,uint256)', [token.toLowerCase(), - tokenId - ]); + const self = (this as any) as OrderValidatorContract; + const encodedData = self._strictEncodeArguments('getERC721TokenOwner(address,uint256)', [ + token.toLowerCase(), + tokenId, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -274,27 +438,26 @@ export class OrderValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getERC721TokenOwner(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - token: string, - tokenId: BigNumber, - ): string { + getABIEncodedTransactionData(token: string, tokenId: BigNumber): string { assert.isString('token', token); assert.isBigNumber('tokenId', tokenId); - const self = this as any as OrderValidatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getERC721TokenOwner(address,uint256)', [token.toLowerCase(), - tokenId - ]); + const self = (this as any) as OrderValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getERC721TokenOwner(address,uint256)', [ + token.toLowerCase(), + tokenId, + ]); return abiEncodedTransactionData; }, }; @@ -304,8 +467,7 @@ export class OrderValidatorContract extends BaseContract { assetData: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<[BigNumber[], BigNumber[]] - > { + ): Promise<[BigNumber[], BigNumber[]]> { assert.isString('target', target); assert.isArray('assetData', assetData); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -316,10 +478,11 @@ export class OrderValidatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as OrderValidatorContract; - const encodedData = self._strictEncodeArguments('getBalancesAndAllowances(address,bytes[])', [target.toLowerCase(), - assetData - ]); + const self = (this as any) as OrderValidatorContract; + const encodedData = self._strictEncodeArguments('getBalancesAndAllowances(address,bytes[])', [ + target.toLowerCase(), + assetData, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -328,39 +491,58 @@ export class OrderValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getBalancesAndAllowances(address,bytes[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<[BigNumber[], BigNumber[]] - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<[BigNumber[], BigNumber[]]>(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - target: string, - assetData: string[], - ): string { + getABIEncodedTransactionData(target: string, assetData: string[]): string { assert.isString('target', target); assert.isArray('assetData', assetData); - const self = this as any as OrderValidatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getBalancesAndAllowances(address,bytes[])', [target.toLowerCase(), - assetData - ]); + const self = (this as any) as OrderValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getBalancesAndAllowances(address,bytes[])', [ + target.toLowerCase(), + assetData, + ]); return abiEncodedTransactionData; }, }; public getTraderInfo = { async callAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, takerAddress: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber} - > { - + ): Promise<{ + makerBalance: BigNumber; + makerAllowance: BigNumber; + takerBalance: BigNumber; + takerAllowance: BigNumber; + makerZrxBalance: BigNumber; + makerZrxAllowance: BigNumber; + takerZrxBalance: BigNumber; + takerZrxAllowance: BigNumber; + }> { assert.isString('takerAddress', takerAddress); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -370,10 +552,11 @@ export class OrderValidatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as OrderValidatorContract; - const encodedData = self._strictEncodeArguments('getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', [order, - takerAddress.toLowerCase() - ]); + const self = (this as any) as OrderValidatorContract; + const encodedData = self._strictEncodeArguments( + 'getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', + [order, takerAddress.toLowerCase()], + ); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -382,37 +565,62 @@ export class OrderValidatorContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)'); + const abiEncoder = self._lookupAbiEncoder( + 'getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', + ); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber} - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue<{ + makerBalance: BigNumber; + makerAllowance: BigNumber; + takerBalance: BigNumber; + takerAllowance: BigNumber; + makerZrxBalance: BigNumber; + makerZrxAllowance: BigNumber; + takerZrxBalance: BigNumber; + takerZrxAllowance: BigNumber; + }>(rawCallResult); // tslint:enable boolean-naming return result; }, getABIEncodedTransactionData( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAddress: string, - ): string { - + order: { + makerAddress: string; + takerAddress: string; + feeRecipientAddress: string; + senderAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerFee: BigNumber; + takerFee: BigNumber; + expirationTimeSeconds: BigNumber; + salt: BigNumber; + makerAssetData: string; + takerAssetData: string; + }, + takerAddress: string, + ): string { assert.isString('takerAddress', takerAddress); - const self = this as any as OrderValidatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', [order, - takerAddress.toLowerCase() - ]); + const self = (this as any) as OrderValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', + [order, takerAddress.toLowerCase()], + ); return abiEncodedTransactionData; }, }; -public static async deployFrom0xArtifactAsync( + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, - _exchange: string, - _zrxAssetData: string, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + _exchange: string, + _zrxAssetData: string, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -425,10 +633,19 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); - return OrderValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, _exchange, -_zrxAssetData -); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, + ); + return OrderValidatorContract.deployAsync( + bytecode, + abi, + provider, + txDefaults, + logDecodeDependenciesAbiOnly, + _exchange, + _zrxAssetData, + ); } public static async deployAsync( bytecode: string, @@ -436,8 +653,8 @@ _zrxAssetData supportedProvider: SupportedProvider, txDefaults: Partial, logDecodeDependencies: { [contractName: string]: ContractAbi }, - _exchange: string, - _zrxAssetData: string, + _exchange: string, + _zrxAssetData: string, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -447,23 +664,17 @@ _zrxAssetData ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_exchange, -_zrxAssetData -] = BaseContract._formatABIDataItemList( + [_exchange, _zrxAssetData] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [_exchange, -_zrxAssetData -], + [_exchange, _zrxAssetData], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_exchange, -_zrxAssetData -]); + const txData = deployInfo.encode(bytecode, [_exchange, _zrxAssetData]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -471,20 +682,22 @@ _zrxAssetData logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`OrderValidator successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new OrderValidatorContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); - contractInstance.constructorArgs = [_exchange, -_zrxAssetData -]; + const contractInstance = new OrderValidatorContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + logDecodeDependencies, + ); + contractInstance.constructorArgs = [_exchange, _zrxAssetData]; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, inputs: [ { @@ -539,7 +752,7 @@ _zrxAssetData name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'takerAddress', @@ -564,7 +777,7 @@ _zrxAssetData name: 'orderTakerAssetFilledAmount', type: 'uint256', }, - ] + ], }, { name: 'traderInfo', @@ -602,14 +815,14 @@ _zrxAssetData name: 'takerZrxAllowance', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -636,7 +849,7 @@ _zrxAssetData stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -691,7 +904,7 @@ _zrxAssetData name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'takerAddresses', @@ -716,7 +929,7 @@ _zrxAssetData name: 'orderTakerAssetFilledAmount', type: 'uint256', }, - ] + ], }, { name: 'tradersInfo', @@ -754,14 +967,14 @@ _zrxAssetData name: 'takerZrxAllowance', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -816,7 +1029,7 @@ _zrxAssetData name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'takerAddresses', @@ -861,14 +1074,14 @@ _zrxAssetData name: 'takerZrxAllowance', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -891,7 +1104,7 @@ _zrxAssetData stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -918,7 +1131,7 @@ _zrxAssetData stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -973,7 +1186,7 @@ _zrxAssetData name: 'takerAssetData', type: 'bytes', }, - ] + ], }, { name: 'takerAddress', @@ -1018,14 +1231,14 @@ _zrxAssetData name: 'takerZrxAllowance', type: 'uint256', }, - ] + ], }, ], payable: false, stateMutability: 'view', type: 'function', }, - { + { inputs: [ { name: '_exchange', @@ -1036,8 +1249,7 @@ _zrxAssetData type: 'bytes', }, ], - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'constructor', @@ -1045,11 +1257,23 @@ _zrxAssetData ] as ContractAbi; return abi; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { - super('OrderValidator', OrderValidatorContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { + super( + 'OrderValidator', + OrderValidatorContract.ABI(), + address, + supportedProvider, + txDefaults, + logDecodeDependencies, + ); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts b/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts index 337f5b2078..fdf60d3ea7 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts @@ -1,11 +1,14 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, +import { + BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; + SubscriptionManager, + PromiseWithTransactionHash, +} from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -63,17 +66,12 @@ export interface WETH9WithdrawalEventArgs extends DecodedLogArgs { _value: BigNumber; } - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class WETH9Contract extends BaseContract { public name = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -82,7 +80,7 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as WETH9Contract; + const self = (this as any) as WETH9Contract; const encodedData = self._strictEncodeArguments('name()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -92,55 +90,45 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('name()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as WETH9Contract; + getABIEncodedTransactionData(): string { + const self = (this as any) as WETH9Contract; const abiEncodedTransactionData = self._strictEncodeArguments('name()', []); return abiEncodedTransactionData; }, }; public approve = { - async sendTransactionAsync( - guy: string, - wad: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isString('guy', guy); - assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy.toLowerCase(), - wad - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind( - self, - guy.toLowerCase(), - wad - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(guy: string, wad: BigNumber, txData?: Partial | undefined): Promise { + assert.isString('guy', guy); + assert.isBigNumber('wad', wad); + const self = (this as any) as WETH9Contract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy.toLowerCase(), wad]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.approve.estimateGasAsync.bind(self, guy.toLowerCase(), wad), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( guy: string, @@ -149,57 +137,48 @@ export class WETH9Contract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('guy', guy); - assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const txHashPromise = self.approve.sendTransactionAsync(guy.toLowerCase(), - wad - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('guy', guy); + assert.isBigNumber('wad', wad); + const self = (this as any) as WETH9Contract; + const txHashPromise = self.approve.sendTransactionAsync(guy.toLowerCase(), wad, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - guy: string, - wad: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isString('guy', guy); - assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy.toLowerCase(), - wad - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(guy: string, wad: BigNumber, txData?: Partial | undefined): Promise { + assert.isString('guy', guy); + assert.isBigNumber('wad', wad); + const self = (this as any) as WETH9Contract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy.toLowerCase(), wad]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( guy: string, wad: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('guy', guy); assert.isBigNumber('wad', wad); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -210,10 +189,8 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy.toLowerCase(), - wad - ]); + const self = (this as any) as WETH9Contract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy.toLowerCase(), wad]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -222,36 +199,31 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - guy: string, - wad: BigNumber, - ): string { + getABIEncodedTransactionData(guy: string, wad: BigNumber): string { assert.isString('guy', guy); assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [guy.toLowerCase(), - wad - ]); + const self = (this as any) as WETH9Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [ + guy.toLowerCase(), + wad, + ]); return abiEncodedTransactionData; }, }; public totalSupply = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -260,7 +232,7 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as WETH9Contract; + const self = (this as any) as WETH9Contract; const encodedData = self._strictEncodeArguments('totalSupply()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -270,20 +242,20 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('totalSupply()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as WETH9Contract; + getABIEncodedTransactionData(): string { + const self = (this as any) as WETH9Contract; const abiEncodedTransactionData = self._strictEncodeArguments('totalSupply()', []); return abiEncodedTransactionData; }, @@ -293,36 +265,32 @@ export class WETH9Contract extends BaseContract { src: string, dst: string, wad: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('src', src); - assert.isString('dst', dst); - assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [src.toLowerCase(), - dst.toLowerCase(), - wad - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind( - self, + assert.isString('src', src); + assert.isString('dst', dst); + assert.isBigNumber('wad', wad); + const self = (this as any) as WETH9Contract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ src.toLowerCase(), dst.toLowerCase(), - wad - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + wad, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferFrom.estimateGasAsync.bind(self, src.toLowerCase(), dst.toLowerCase(), wad), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( src: string, @@ -332,25 +300,27 @@ export class WETH9Contract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('src', src); - assert.isString('dst', dst); - assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const txHashPromise = self.transferFrom.sendTransactionAsync(src.toLowerCase(), - dst.toLowerCase(), - wad - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('src', src); + assert.isString('dst', dst); + assert.isBigNumber('wad', wad); + const self = (this as any) as WETH9Contract; + const txHashPromise = self.transferFrom.sendTransactionAsync( + src.toLowerCase(), + dst.toLowerCase(), + wad, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( src: string, @@ -358,28 +328,29 @@ export class WETH9Contract extends BaseContract { wad: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('src', src); - assert.isString('dst', dst); - assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [src.toLowerCase(), - dst.toLowerCase(), - wad - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('src', src); + assert.isString('dst', dst); + assert.isBigNumber('wad', wad); + const self = (this as any) as WETH9Contract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + src.toLowerCase(), + dst.toLowerCase(), + wad, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( src: string, @@ -387,8 +358,7 @@ export class WETH9Contract extends BaseContract { wad: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('src', src); assert.isString('dst', dst); assert.isBigNumber('wad', wad); @@ -400,11 +370,12 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [src.toLowerCase(), - dst.toLowerCase(), - wad - ]); + const self = (this as any) as WETH9Contract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + src.toLowerCase(), + dst.toLowerCase(), + wad, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -413,60 +384,51 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - src: string, - dst: string, - wad: BigNumber, - ): string { + getABIEncodedTransactionData(src: string, dst: string, wad: BigNumber): string { assert.isString('src', src); assert.isString('dst', dst); assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [src.toLowerCase(), - dst.toLowerCase(), - wad - ]); + const self = (this as any) as WETH9Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + src.toLowerCase(), + dst.toLowerCase(), + wad, + ]); return abiEncodedTransactionData; }, }; public withdraw = { - async sendTransactionAsync( - wad: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.withdraw.estimateGasAsync.bind( - self, - wad - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(wad: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('wad', wad); + const self = (this as any) as WETH9Contract; + const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.withdraw.estimateGasAsync.bind(self, wad), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( wad: BigNumber, @@ -474,51 +436,41 @@ export class WETH9Contract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const txHashPromise = self.withdraw.sendTransactionAsync(wad - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isBigNumber('wad', wad); + const self = (this as any) as WETH9Contract; + const txHashPromise = self.withdraw.sendTransactionAsync(wad, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - wad: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(wad: BigNumber, txData?: Partial | undefined): Promise { + assert.isBigNumber('wad', wad); + const self = (this as any) as WETH9Contract; + const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - wad: BigNumber, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(wad: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.isBigNumber('wad', wad); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -528,9 +480,8 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad - ]); + const self = (this as any) as WETH9Contract; + const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -539,33 +490,27 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('withdraw(uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - wad: BigNumber, - ): string { + getABIEncodedTransactionData(wad: BigNumber): string { assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('withdraw(uint256)', [wad - ]); + const self = (this as any) as WETH9Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('withdraw(uint256)', [wad]); return abiEncodedTransactionData; }, }; public decimals = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -574,7 +519,7 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as WETH9Contract; + const self = (this as any) as WETH9Contract; const encodedData = self._strictEncodeArguments('decimals()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -584,20 +529,20 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('decimals()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as WETH9Contract; + getABIEncodedTransactionData(): string { + const self = (this as any) as WETH9Contract; const abiEncodedTransactionData = self._strictEncodeArguments('decimals()', []); return abiEncodedTransactionData; }, @@ -607,8 +552,7 @@ export class WETH9Contract extends BaseContract { index_0: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -618,9 +562,8 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [index_0.toLowerCase() - ]); + const self = (this as any) as WETH9Contract; + const encodedData = self._strictEncodeArguments('balanceOf(address)', [index_0.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -629,33 +572,29 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: string, - ): string { + getABIEncodedTransactionData(index_0: string): string { assert.isString('index_0', index_0); - const self = this as any as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [index_0.toLowerCase() - ]); + const self = (this as any) as WETH9Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [ + index_0.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; public symbol = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -664,7 +603,7 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as WETH9Contract; + const self = (this as any) as WETH9Contract; const encodedData = self._strictEncodeArguments('symbol()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -674,55 +613,45 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('symbol()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as WETH9Contract; + getABIEncodedTransactionData(): string { + const self = (this as any) as WETH9Contract; const abiEncodedTransactionData = self._strictEncodeArguments('symbol()', []); return abiEncodedTransactionData; }, }; public transfer = { - async sendTransactionAsync( - dst: string, - wad: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isString('dst', dst); - assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst.toLowerCase(), - wad - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transfer.estimateGasAsync.bind( - self, - dst.toLowerCase(), - wad - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(dst: string, wad: BigNumber, txData?: Partial | undefined): Promise { + assert.isString('dst', dst); + assert.isBigNumber('wad', wad); + const self = (this as any) as WETH9Contract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst.toLowerCase(), wad]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transfer.estimateGasAsync.bind(self, dst.toLowerCase(), wad), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( dst: string, @@ -731,57 +660,48 @@ export class WETH9Contract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('dst', dst); - assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const txHashPromise = self.transfer.sendTransactionAsync(dst.toLowerCase(), - wad - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('dst', dst); + assert.isBigNumber('wad', wad); + const self = (this as any) as WETH9Contract; + const txHashPromise = self.transfer.sendTransactionAsync(dst.toLowerCase(), wad, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - dst: string, - wad: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isString('dst', dst); - assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst.toLowerCase(), - wad - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(dst: string, wad: BigNumber, txData?: Partial | undefined): Promise { + assert.isString('dst', dst); + assert.isBigNumber('wad', wad); + const self = (this as any) as WETH9Contract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst.toLowerCase(), wad]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( dst: string, wad: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('dst', dst); assert.isBigNumber('wad', wad); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -792,10 +712,8 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst.toLowerCase(), - wad - ]); + const self = (this as any) as WETH9Contract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst.toLowerCase(), wad]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -804,98 +722,87 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - dst: string, - wad: BigNumber, - ): string { + getABIEncodedTransactionData(dst: string, wad: BigNumber): string { assert.isString('dst', dst); assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [dst.toLowerCase(), - wad - ]); + const self = (this as any) as WETH9Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [ + dst.toLowerCase(), + wad, + ]); return abiEncodedTransactionData; }, }; public deposit = { - async sendTransactionAsync( - txData?: Partial | undefined, - ): Promise { - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('deposit()', []); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.deposit.estimateGasAsync.bind( - self, - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + async sendTransactionAsync(txData?: Partial | undefined): Promise { + const self = (this as any) as WETH9Contract; + const encodedData = self._strictEncodeArguments('deposit()', []); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.deposit.estimateGasAsync.bind(self), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( txData?: Partial, pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - const self = this as any as WETH9Contract; - const txHashPromise = self.deposit.sendTransactionAsync(txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + const self = (this as any) as WETH9Contract; + const txHashPromise = self.deposit.sendTransactionAsync(txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - txData?: Partial | undefined, - ): Promise { - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('deposit()', []); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(txData?: Partial | undefined): Promise { + const self = (this as any) as WETH9Contract; + const encodedData = self._strictEncodeArguments('deposit()', []); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -904,7 +811,7 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as WETH9Contract; + const self = (this as any) as WETH9Contract; const encodedData = self._strictEncodeArguments('deposit()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -914,20 +821,20 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('deposit()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as WETH9Contract; + getABIEncodedTransactionData(): string { + const self = (this as any) as WETH9Contract; const abiEncodedTransactionData = self._strictEncodeArguments('deposit()', []); return abiEncodedTransactionData; }, @@ -938,8 +845,7 @@ export class WETH9Contract extends BaseContract { index_1: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('index_0', index_0); assert.isString('index_1', index_1); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -950,10 +856,11 @@ export class WETH9Contract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('allowance(address,address)', [index_0.toLowerCase(), - index_1.toLowerCase() - ]); + const self = (this as any) as WETH9Contract; + const encodedData = self._strictEncodeArguments('allowance(address,address)', [ + index_0.toLowerCase(), + index_1.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -962,36 +869,35 @@ export class WETH9Contract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - index_0: string, - index_1: string, - ): string { + getABIEncodedTransactionData(index_0: string, index_1: string): string { assert.isString('index_0', index_0); assert.isString('index_1', index_1); - const self = this as any as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [index_0.toLowerCase(), - index_1.toLowerCase() - ]); + const self = (this as any) as WETH9Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [ + index_0.toLowerCase(), + index_1.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; -private readonly _subscriptionManager: SubscriptionManager; -public static async deployFrom0xArtifactAsync( + private readonly _subscriptionManager: SubscriptionManager; + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -1004,8 +910,11 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); - return WETH9Contract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, + ); + return WETH9Contract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( bytecode: string, @@ -1022,17 +931,13 @@ public static async deployFrom0xArtifactAsync( ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); + [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -1040,21 +945,24 @@ public static async deployFrom0xArtifactAsync( logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`WETH9 successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new WETH9Contract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); + const contractInstance = new WETH9Contract( + txReceipt.contractAddress as string, + provider, + txDefaults, + logDecodeDependencies, + ); contractInstance.constructorArgs = []; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'name', outputs: [ { @@ -1066,7 +974,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1089,10 +997,9 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'totalSupply', outputs: [ { @@ -1104,7 +1011,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1131,7 +1038,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1140,16 +1047,14 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'withdraw', - outputs: [ - ], + outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'decimals', outputs: [ { @@ -1161,7 +1066,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1180,10 +1085,9 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'symbol', outputs: [ { @@ -1195,7 +1099,7 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { + { constant: false, inputs: [ { @@ -1218,18 +1122,16 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'nonpayable', type: 'function', }, - { + { constant: false, - inputs: [ - ], + inputs: [], name: 'deposit', - outputs: [ - ], + outputs: [], payable: true, stateMutability: 'payable', type: 'function', }, - { + { constant: true, inputs: [ { @@ -1252,16 +1154,14 @@ public static async deployFrom0xArtifactAsync( stateMutability: 'view', type: 'function', }, - { - inputs: [ - ], - outputs: [ - ], + { + inputs: [], + outputs: [], payable: true, stateMutability: 'payable', type: 'fallback', }, - { + { anonymous: false, inputs: [ { @@ -1281,11 +1181,10 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'Approval', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1305,11 +1204,10 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'Transfer', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1324,11 +1222,10 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'Deposit', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1343,8 +1240,7 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'Withdrawal', - outputs: [ - ], + outputs: [], type: 'event', }, ] as ContractAbi; @@ -1418,7 +1314,12 @@ public static async deployFrom0xArtifactAsync( ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { super('WETH9', WETH9Contract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( @@ -1426,7 +1327,7 @@ public static async deployFrom0xArtifactAsync( this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align 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 04b7f16718..d980c02253 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts @@ -1,11 +1,14 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma // tslint:disable:whitespace no-unbound-method no-trailing-whitespace // tslint:disable:no-unused-variable -import { BaseContract, +import { + BaseContract, BlockRange, EventCallback, IndexedFilterValues, - SubscriptionManager,PromiseWithTransactionHash } from '@0x/base-contract'; + SubscriptionManager, + PromiseWithTransactionHash, +} from '@0x/base-contract'; import { schemas } from '@0x/json-schemas'; import { BlockParam, @@ -28,9 +31,7 @@ import { assert } from '@0x/assert'; import * as ethers from 'ethers'; // tslint:enable:no-unused-variable -export type ZRXTokenEventArgs = - | ZRXTokenTransferEventArgs - | ZRXTokenApprovalEventArgs; +export type ZRXTokenEventArgs = ZRXTokenTransferEventArgs | ZRXTokenApprovalEventArgs; export enum ZRXTokenEvents { Transfer = 'Transfer', @@ -49,17 +50,12 @@ export interface ZRXTokenApprovalEventArgs extends DecodedLogArgs { _value: BigNumber; } - /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class ZRXTokenContract extends BaseContract { public name = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -68,7 +64,7 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ZRXTokenContract; + const self = (this as any) as ZRXTokenContract; const encodedData = self._strictEncodeArguments('name()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -78,20 +74,20 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('name()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as ZRXTokenContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as ZRXTokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('name()', []); return abiEncodedTransactionData; }, @@ -100,33 +96,30 @@ export class ZRXTokenContract extends BaseContract { async sendTransactionAsync( _spender: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = this as any as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind( - self, + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = (this as any) as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ _spender.toLowerCase(), - _value - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _value, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.approve.estimateGasAsync.bind(self, _spender.toLowerCase(), _value), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _spender: string, @@ -135,57 +128,55 @@ export class ZRXTokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = this as any as ZRXTokenContract; - const txHashPromise = self.approve.sendTransactionAsync(_spender.toLowerCase(), - _value - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = (this as any) as ZRXTokenContract; + const txHashPromise = self.approve.sendTransactionAsync(_spender.toLowerCase(), _value, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _spender: string, _value: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = this as any as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = (this as any) as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + _spender.toLowerCase(), + _value, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _spender: string, _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -196,10 +187,11 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), - _value - ]); + const self = (this as any) as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [ + _spender.toLowerCase(), + _value, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -208,36 +200,31 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _spender: string, - _value: BigNumber, - ): string { + getABIEncodedTransactionData(_spender: string, _value: BigNumber): string { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); - const self = this as any as ZRXTokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_spender.toLowerCase(), - _value - ]); + const self = (this as any) as ZRXTokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [ + _spender.toLowerCase(), + _value, + ]); return abiEncodedTransactionData; }, }; public totalSupply = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -246,7 +233,7 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ZRXTokenContract; + const self = (this as any) as ZRXTokenContract; const encodedData = self._strictEncodeArguments('totalSupply()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -256,20 +243,20 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('totalSupply()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as ZRXTokenContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as ZRXTokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('totalSupply()', []); return abiEncodedTransactionData; }, @@ -279,36 +266,32 @@ export class ZRXTokenContract extends BaseContract { _from: string, _to: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind( - self, + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ _from.toLowerCase(), _to.toLowerCase(), - _value - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + _value, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transferFrom.estimateGasAsync.bind(self, _from.toLowerCase(), _to.toLowerCase(), _value), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _from: string, @@ -318,25 +301,27 @@ export class ZRXTokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as ZRXTokenContract; - const txHashPromise = self.transferFrom.sendTransactionAsync(_from.toLowerCase(), - _to.toLowerCase(), - _value - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as ZRXTokenContract; + const txHashPromise = self.transferFrom.sendTransactionAsync( + _from.toLowerCase(), + _to.toLowerCase(), + _value, + txData, + ); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( _from: string, @@ -344,28 +329,29 @@ export class ZRXTokenContract extends BaseContract { _value: BigNumber, txData?: Partial | undefined, ): Promise { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _value, + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _from: string, @@ -373,8 +359,7 @@ export class ZRXTokenContract extends BaseContract { _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_value', _value); @@ -386,11 +371,12 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _value - ]); + const self = (this as any) as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _value, + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -399,39 +385,33 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _value: BigNumber, - ): string { + getABIEncodedTransactionData(_from: string, _to: string, _value: BigNumber): string { assert.isString('_from', _from); assert.isString('_to', _to); assert.isBigNumber('_value', _value); - const self = this as any as ZRXTokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from.toLowerCase(), - _to.toLowerCase(), - _value - ]); + const self = (this as any) as ZRXTokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [ + _from.toLowerCase(), + _to.toLowerCase(), + _value, + ]); return abiEncodedTransactionData; }, }; public decimals = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -440,7 +420,7 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ZRXTokenContract; + const self = (this as any) as ZRXTokenContract; const encodedData = self._strictEncodeArguments('decimals()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -450,20 +430,20 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('decimals()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as ZRXTokenContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as ZRXTokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('decimals()', []); return abiEncodedTransactionData; }, @@ -473,8 +453,7 @@ export class ZRXTokenContract extends BaseContract { _owner: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -484,9 +463,8 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() - ]); + const self = (this as any) as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -495,33 +473,27 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _owner: string, - ): string { + getABIEncodedTransactionData(_owner: string): string { assert.isString('_owner', _owner); - const self = this as any as ZRXTokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase() - ]); + const self = (this as any) as ZRXTokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); return abiEncodedTransactionData; }, }; public symbol = { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -530,7 +502,7 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ZRXTokenContract; + const self = (this as any) as ZRXTokenContract; const encodedData = self._strictEncodeArguments('symbol()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -540,20 +512,20 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('symbol()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as ZRXTokenContract; + getABIEncodedTransactionData(): string { + const self = (this as any) as ZRXTokenContract; const abiEncodedTransactionData = self._strictEncodeArguments('symbol()', []); return abiEncodedTransactionData; }, @@ -562,33 +534,27 @@ export class ZRXTokenContract extends BaseContract { async sendTransactionAsync( _to: string, _value: BigNumber, - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transfer.estimateGasAsync.bind( - self, - _to.toLowerCase(), - _value - ), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.transfer.estimateGasAsync.bind(self, _to.toLowerCase(), _value), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( _to: string, @@ -597,57 +563,48 @@ export class ZRXTokenContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as ZRXTokenContract; - const txHashPromise = self.transfer.sendTransactionAsync(_to.toLowerCase(), - _value - , txData); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as ZRXTokenContract; + const txHashPromise = self.transfer.sendTransactionAsync(_to.toLowerCase(), _value, txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, - async estimateGasAsync( - _to: string, - _value: BigNumber, - txData?: Partial | undefined, - ): Promise { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - if (txDataWithDefaults.from !== undefined) { - txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; + async estimateGasAsync(_to: string, _value: BigNumber, txData?: Partial | undefined): Promise { + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = (this as any) as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( _to: string, _value: BigNumber, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_to', _to); assert.isBigNumber('_value', _value); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -658,10 +615,8 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), - _value - ]); + const self = (this as any) as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), _value]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -670,27 +625,26 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _to: string, - _value: BigNumber, - ): string { + getABIEncodedTransactionData(_to: string, _value: BigNumber): string { assert.isString('_to', _to); assert.isBigNumber('_value', _value); - const self = this as any as ZRXTokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_to.toLowerCase(), - _value - ]); + const self = (this as any) as ZRXTokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [ + _to.toLowerCase(), + _value, + ]); return abiEncodedTransactionData; }, }; @@ -700,8 +654,7 @@ export class ZRXTokenContract extends BaseContract { _spender: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('_owner', _owner); assert.isString('_spender', _spender); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -712,10 +665,11 @@ export class ZRXTokenContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = this as any as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('allowance(address,address)', [_owner.toLowerCase(), - _spender.toLowerCase() - ]); + const self = (this as any) as ZRXTokenContract; + const encodedData = self._strictEncodeArguments('allowance(address,address)', [ + _owner.toLowerCase(), + _spender.toLowerCase(), + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -724,36 +678,35 @@ export class ZRXTokenContract extends BaseContract { }, self._web3Wrapper.getContractDefaults(), ); - callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, - getABIEncodedTransactionData( - _owner: string, - _spender: string, - ): string { + getABIEncodedTransactionData(_owner: string, _spender: string): string { assert.isString('_owner', _owner); assert.isString('_spender', _spender); - const self = this as any as ZRXTokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [_owner.toLowerCase(), - _spender.toLowerCase() - ]); + const self = (this as any) as ZRXTokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [ + _owner.toLowerCase(), + _spender.toLowerCase(), + ]); return abiEncodedTransactionData; }, }; -private readonly _subscriptionManager: SubscriptionManager; -public static async deployFrom0xArtifactAsync( + private readonly _subscriptionManager: SubscriptionManager; + public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: (ContractArtifact | SimpleContractArtifact) }, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -766,8 +719,11 @@ public static async deployFrom0xArtifactAsync( const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); - return ZRXTokenContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( + (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), + {}, + ); + return ZRXTokenContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( bytecode: string, @@ -784,17 +740,13 @@ public static async deployFrom0xArtifactAsync( ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); + [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, []); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, + { data: txData }, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -802,21 +754,24 @@ public static async deployFrom0xArtifactAsync( logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`ZRXToken successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ZRXTokenContract(txReceipt.contractAddress as string, provider, txDefaults, logDecodeDependencies); + const contractInstance = new ZRXTokenContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + logDecodeDependencies, + ); contractInstance.constructorArgs = []; return contractInstance; } - /** * @returns The contract ABI */ public static ABI(): ContractAbi { const abi = [ - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'name', outputs: [ { @@ -827,7 +782,7 @@ public static async deployFrom0xArtifactAsync( payable: false, type: 'function', }, - { + { constant: false, inputs: [ { @@ -849,10 +804,9 @@ public static async deployFrom0xArtifactAsync( payable: false, type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'totalSupply', outputs: [ { @@ -863,7 +817,7 @@ public static async deployFrom0xArtifactAsync( payable: false, type: 'function', }, - { + { constant: false, inputs: [ { @@ -889,10 +843,9 @@ public static async deployFrom0xArtifactAsync( payable: false, type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'decimals', outputs: [ { @@ -903,7 +856,7 @@ public static async deployFrom0xArtifactAsync( payable: false, type: 'function', }, - { + { constant: true, inputs: [ { @@ -921,10 +874,9 @@ public static async deployFrom0xArtifactAsync( payable: false, type: 'function', }, - { + { constant: true, - inputs: [ - ], + inputs: [], name: 'symbol', outputs: [ { @@ -935,7 +887,7 @@ public static async deployFrom0xArtifactAsync( payable: false, type: 'function', }, - { + { constant: false, inputs: [ { @@ -957,7 +909,7 @@ public static async deployFrom0xArtifactAsync( payable: false, type: 'function', }, - { + { constant: true, inputs: [ { @@ -979,15 +931,13 @@ public static async deployFrom0xArtifactAsync( payable: false, type: 'function', }, - { - inputs: [ - ], - outputs: [ - ], + { + inputs: [], + outputs: [], payable: false, type: 'constructor', }, - { + { anonymous: false, inputs: [ { @@ -1007,11 +957,10 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'Transfer', - outputs: [ - ], + outputs: [], type: 'event', }, - { + { anonymous: false, inputs: [ { @@ -1031,8 +980,7 @@ public static async deployFrom0xArtifactAsync( }, ], name: 'Approval', - outputs: [ - ], + outputs: [], type: 'event', }, ] as ContractAbi; @@ -1106,7 +1054,12 @@ public static async deployFrom0xArtifactAsync( ); return logs; } - constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial, logDecodeDependencies?: { [contractName: string]: ContractAbi }) { + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { super('ZRXToken', ZRXTokenContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); this._subscriptionManager = new SubscriptionManager( @@ -1114,7 +1067,7 @@ public static async deployFrom0xArtifactAsync( this._web3Wrapper, ); } -} +} // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align From 0aadb789a593eab548b6f6b4751b493c12d53562 Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Mon, 29 Jul 2019 16:45:13 +0200 Subject: [PATCH 14/15] Fixed linter errors --- packages/abi-gen-templates/contract.handlebars | 2 +- .../src/generated-wrappers/asset_proxy_owner.ts | 7 +++---- .../abi-gen-wrappers/src/generated-wrappers/coordinator.ts | 7 +++---- .../src/generated-wrappers/coordinator_registry.ts | 7 +++---- .../src/generated-wrappers/dummy_erc20_token.ts | 7 +++---- .../src/generated-wrappers/dummy_erc721_token.ts | 7 +++---- .../src/generated-wrappers/dutch_auction.ts | 7 +++---- .../abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts | 7 +++---- .../abi-gen-wrappers/src/generated-wrappers/erc20_token.ts | 7 +++---- .../src/generated-wrappers/erc721_proxy.ts | 7 +++---- .../src/generated-wrappers/erc721_token.ts | 7 +++---- .../src/generated-wrappers/eth_balance_checker.ts | 7 +++---- .../abi-gen-wrappers/src/generated-wrappers/exchange.ts | 7 +++---- .../abi-gen-wrappers/src/generated-wrappers/forwarder.ts | 7 +++---- .../src/generated-wrappers/i_asset_proxy.ts | 7 +++---- .../abi-gen-wrappers/src/generated-wrappers/i_validator.ts | 7 +++---- .../abi-gen-wrappers/src/generated-wrappers/i_wallet.ts | 7 +++---- .../src/generated-wrappers/multi_asset_proxy.ts | 7 +++---- .../src/generated-wrappers/order_validator.ts | 7 +++---- packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts | 7 +++---- .../abi-gen-wrappers/src/generated-wrappers/zrx_token.ts | 7 +++---- .../test-cli/expected-output/typescript/abi_gen_dummy.ts | 7 +++---- .../test-cli/expected-output/typescript/lib_dummy.ts | 7 +++---- .../test-cli/expected-output/typescript/test_lib_dummy.ts | 7 +++---- 24 files changed, 70 insertions(+), 93 deletions(-) diff --git a/packages/abi-gen-templates/contract.handlebars b/packages/abi-gen-templates/contract.handlebars index b9683d30f8..489df8ceea 100644 --- a/packages/abi-gen-templates/contract.handlebars +++ b/packages/abi-gen-templates/contract.handlebars @@ -77,7 +77,7 @@ export class {{contractName}}Contract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce((accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), {}); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ [contractName: string]: ContractAbi }>((accumulator, [key, value]) => ({...{[key]: value.compilerOutput.abi}}),{}); return {{contractName}}Contract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, {{> params inputs=ctor.inputs}}); } public static async deployAsync( 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 d4f38be5c3..a24031e1a8 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 @@ -2113,10 +2113,9 @@ export class AssetProxyOwnerContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ + [contractName: string]: ContractAbi; + }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); return AssetProxyOwnerContract.deployAsync( bytecode, abi, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts index 305e0b38aa..d65b3977ab 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts @@ -629,10 +629,9 @@ export class CoordinatorContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ + [contractName: string]: ContractAbi; + }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); return CoordinatorContract.deployAsync( bytecode, abi, 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 50ea62a44f..d93ffb467a 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts @@ -218,10 +218,9 @@ export class CoordinatorRegistryContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ + [contractName: string]: ContractAbi; + }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); return CoordinatorRegistryContract.deployAsync( bytecode, abi, 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 7947130b0d..1d186f95ac 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 @@ -1132,10 +1132,9 @@ export class DummyERC20TokenContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ + [contractName: string]: ContractAbi; + }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); return DummyERC20TokenContract.deployAsync( bytecode, abi, 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 c3ad0fed54..895eb1279a 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 @@ -1460,10 +1460,9 @@ export class DummyERC721TokenContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ + [contractName: string]: ContractAbi; + }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); return DummyERC721TokenContract.deployAsync( bytecode, abi, 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 e7aa2434df..5dfd3145de 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts @@ -553,10 +553,9 @@ export class DutchAuctionContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ + [contractName: string]: ContractAbi; + }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); return DutchAuctionContract.deployAsync( bytecode, abi, 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 bcfd2f5b1c..166736aec0 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts @@ -717,10 +717,9 @@ export class ERC20ProxyContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ + [contractName: string]: ContractAbi; + }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); return ERC20ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( 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 58b2815bc4..47837ac17b 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts @@ -605,10 +605,9 @@ export class ERC20TokenContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ + [contractName: string]: ContractAbi; + }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); return ERC20TokenContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( 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 ee5085d4ab..0281bd6100 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts @@ -717,10 +717,9 @@ export class ERC721ProxyContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ + [contractName: string]: ContractAbi; + }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); return ERC721ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( 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 2a0420e010..9ff5e1a6d2 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts @@ -998,10 +998,9 @@ export class ERC721TokenContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ + [contractName: string]: ContractAbi; + }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); return ERC721TokenContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( 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 e4a6c2ac39..f0428ecd56 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 @@ -88,10 +88,9 @@ export class EthBalanceCheckerContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ + [contractName: string]: ContractAbi; + }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); return EthBalanceCheckerContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts index 873bde5b79..ead2ef1dda 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts @@ -4582,10 +4582,9 @@ export class ExchangeContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ + [contractName: string]: ContractAbi; + }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); return ExchangeContract.deployAsync( bytecode, abi, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts b/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts index 4a4e7f68ef..fcf18ab937 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts @@ -1057,10 +1057,9 @@ export class ForwarderContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ + [contractName: string]: ContractAbi; + }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); return ForwarderContract.deployAsync( bytecode, abi, 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 13b92cc118..8330779a82 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 @@ -722,10 +722,9 @@ export class IAssetProxyContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ + [contractName: string]: ContractAbi; + }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); return IAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( 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 fd016262d4..2c194a3c96 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts @@ -102,10 +102,9 @@ export class IValidatorContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ + [contractName: string]: ContractAbi; + }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); return IValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( 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 20a8250ba8..83ca828c21 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts @@ -94,10 +94,9 @@ export class IWalletContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ + [contractName: string]: ContractAbi; + }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); return IWalletContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( 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 92628c0c03..c9a8a30608 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 @@ -914,10 +914,9 @@ export class MultiAssetProxyContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ + [contractName: string]: ContractAbi; + }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); return MultiAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( 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 2183ee494f..1ab8adfa20 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts @@ -633,10 +633,9 @@ export class OrderValidatorContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ + [contractName: string]: ContractAbi; + }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); return OrderValidatorContract.deployAsync( bytecode, abi, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts b/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts index fdf60d3ea7..5a48c87259 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts @@ -910,10 +910,9 @@ export class WETH9Contract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ + [contractName: string]: ContractAbi; + }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); return WETH9Contract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( 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 d980c02253..ee6b43b77b 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts @@ -719,10 +719,9 @@ export class ZRXTokenContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ + [contractName: string]: ContractAbi; + }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); return ZRXTokenContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( diff --git a/packages/abi-gen/test-cli/expected-output/typescript/abi_gen_dummy.ts b/packages/abi-gen/test-cli/expected-output/typescript/abi_gen_dummy.ts index 0c7af7906f..fad08205fe 100644 --- a/packages/abi-gen/test-cli/expected-output/typescript/abi_gen_dummy.ts +++ b/packages/abi-gen/test-cli/expected-output/typescript/abi_gen_dummy.ts @@ -1035,10 +1035,9 @@ export class AbiGenDummyContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ + [contractName: string]: ContractAbi; + }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); return AbiGenDummyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( diff --git a/packages/abi-gen/test-cli/expected-output/typescript/lib_dummy.ts b/packages/abi-gen/test-cli/expected-output/typescript/lib_dummy.ts index 38469721ec..56cb550cf5 100644 --- a/packages/abi-gen/test-cli/expected-output/typescript/lib_dummy.ts +++ b/packages/abi-gen/test-cli/expected-output/typescript/lib_dummy.ts @@ -44,10 +44,9 @@ export class LibDummyContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ + [contractName: string]: ContractAbi; + }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); return LibDummyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( diff --git a/packages/abi-gen/test-cli/expected-output/typescript/test_lib_dummy.ts b/packages/abi-gen/test-cli/expected-output/typescript/test_lib_dummy.ts index d5d5437643..8c898b358a 100644 --- a/packages/abi-gen/test-cli/expected-output/typescript/test_lib_dummy.ts +++ b/packages/abi-gen/test-cli/expected-output/typescript/test_lib_dummy.ts @@ -124,10 +124,9 @@ export class TestLibDummyContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce( - (accumulator, [key, value]) => Object.assign(accumulator, { [key]: value.compilerOutput.abi }), - {}, - ); + const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ + [contractName: string]: ContractAbi; + }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); return TestLibDummyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( From 6f6411556170a323dd8fdd6fe1421ead19e78bc3 Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Mon, 29 Jul 2019 17:24:32 +0200 Subject: [PATCH 15/15] Switched assignment of `logDecodeDependenciesAbiOnly` for readability and to pass linter --- packages/abi-gen-templates/contract.handlebars | 5 ++++- .../src/generated-wrappers/asset_proxy_owner.ts | 7 ++++--- .../abi-gen-wrappers/src/generated-wrappers/coordinator.ts | 7 ++++--- .../src/generated-wrappers/coordinator_registry.ts | 7 ++++--- .../src/generated-wrappers/dummy_erc20_token.ts | 7 ++++--- .../src/generated-wrappers/dummy_erc721_token.ts | 7 ++++--- .../src/generated-wrappers/dutch_auction.ts | 7 ++++--- .../abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts | 7 ++++--- .../abi-gen-wrappers/src/generated-wrappers/erc20_token.ts | 7 ++++--- .../src/generated-wrappers/erc721_proxy.ts | 7 ++++--- .../src/generated-wrappers/erc721_token.ts | 7 ++++--- .../src/generated-wrappers/eth_balance_checker.ts | 7 ++++--- .../abi-gen-wrappers/src/generated-wrappers/exchange.ts | 7 ++++--- .../abi-gen-wrappers/src/generated-wrappers/forwarder.ts | 7 ++++--- .../src/generated-wrappers/i_asset_proxy.ts | 7 ++++--- .../abi-gen-wrappers/src/generated-wrappers/i_validator.ts | 7 ++++--- .../abi-gen-wrappers/src/generated-wrappers/i_wallet.ts | 7 ++++--- .../src/generated-wrappers/multi_asset_proxy.ts | 7 ++++--- .../src/generated-wrappers/order_validator.ts | 7 ++++--- packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts | 7 ++++--- .../abi-gen-wrappers/src/generated-wrappers/zrx_token.ts | 7 ++++--- .../test-cli/expected-output/typescript/abi_gen_dummy.ts | 7 ++++--- .../test-cli/expected-output/typescript/lib_dummy.ts | 7 ++++--- .../test-cli/expected-output/typescript/test_lib_dummy.ts | 7 ++++--- 24 files changed, 96 insertions(+), 70 deletions(-) diff --git a/packages/abi-gen-templates/contract.handlebars b/packages/abi-gen-templates/contract.handlebars index 489df8ceea..f30bf50e58 100644 --- a/packages/abi-gen-templates/contract.handlebars +++ b/packages/abi-gen-templates/contract.handlebars @@ -77,7 +77,10 @@ export class {{contractName}}Contract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ [contractName: string]: ContractAbi }>((accumulator, [key, value]) => ({...{[key]: value.compilerOutput.abi}}),{}); + const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {}; + for (const key of Object.keys(logDecodeDependencies)) { + logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi; + } return {{contractName}}Contract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, {{> params inputs=ctor.inputs}}); } public static async deployAsync( 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 a24031e1a8..a142985a13 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 @@ -2113,9 +2113,10 @@ export class AssetProxyOwnerContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ - [contractName: string]: ContractAbi; - }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); + const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {}; + for (const key of Object.keys(logDecodeDependencies)) { + logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi; + } return AssetProxyOwnerContract.deployAsync( bytecode, abi, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts index d65b3977ab..a3f2b2fa94 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts @@ -629,9 +629,10 @@ export class CoordinatorContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ - [contractName: string]: ContractAbi; - }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); + const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {}; + for (const key of Object.keys(logDecodeDependencies)) { + logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi; + } return CoordinatorContract.deployAsync( bytecode, abi, 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 d93ffb467a..ce84a8659c 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts @@ -218,9 +218,10 @@ export class CoordinatorRegistryContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ - [contractName: string]: ContractAbi; - }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); + const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {}; + for (const key of Object.keys(logDecodeDependencies)) { + logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi; + } return CoordinatorRegistryContract.deployAsync( bytecode, abi, 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 1d186f95ac..ed57e40b1c 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 @@ -1132,9 +1132,10 @@ export class DummyERC20TokenContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ - [contractName: string]: ContractAbi; - }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); + const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {}; + for (const key of Object.keys(logDecodeDependencies)) { + logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi; + } return DummyERC20TokenContract.deployAsync( bytecode, abi, 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 895eb1279a..3e07f54492 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 @@ -1460,9 +1460,10 @@ export class DummyERC721TokenContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ - [contractName: string]: ContractAbi; - }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); + const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {}; + for (const key of Object.keys(logDecodeDependencies)) { + logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi; + } return DummyERC721TokenContract.deployAsync( bytecode, abi, 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 5dfd3145de..0820789ee1 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts @@ -553,9 +553,10 @@ export class DutchAuctionContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ - [contractName: string]: ContractAbi; - }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); + const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {}; + for (const key of Object.keys(logDecodeDependencies)) { + logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi; + } return DutchAuctionContract.deployAsync( bytecode, abi, 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 166736aec0..9aaa9a7dbe 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts @@ -717,9 +717,10 @@ export class ERC20ProxyContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ - [contractName: string]: ContractAbi; - }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); + const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {}; + for (const key of Object.keys(logDecodeDependencies)) { + logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi; + } return ERC20ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( 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 47837ac17b..bb2f97bf46 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts @@ -605,9 +605,10 @@ export class ERC20TokenContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ - [contractName: string]: ContractAbi; - }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); + const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {}; + for (const key of Object.keys(logDecodeDependencies)) { + logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi; + } return ERC20TokenContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( 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 0281bd6100..28b991cb80 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts @@ -717,9 +717,10 @@ export class ERC721ProxyContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ - [contractName: string]: ContractAbi; - }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); + const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {}; + for (const key of Object.keys(logDecodeDependencies)) { + logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi; + } return ERC721ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( 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 9ff5e1a6d2..b1d5938cca 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts @@ -998,9 +998,10 @@ export class ERC721TokenContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ - [contractName: string]: ContractAbi; - }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); + const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {}; + for (const key of Object.keys(logDecodeDependencies)) { + logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi; + } return ERC721TokenContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( 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 f0428ecd56..f0715bcea0 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 @@ -88,9 +88,10 @@ export class EthBalanceCheckerContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ - [contractName: string]: ContractAbi; - }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); + const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {}; + for (const key of Object.keys(logDecodeDependencies)) { + logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi; + } return EthBalanceCheckerContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts index ead2ef1dda..532f3b5fd3 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts @@ -4582,9 +4582,10 @@ export class ExchangeContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ - [contractName: string]: ContractAbi; - }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); + const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {}; + for (const key of Object.keys(logDecodeDependencies)) { + logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi; + } return ExchangeContract.deployAsync( bytecode, abi, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts b/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts index fcf18ab937..868a0f198a 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts @@ -1057,9 +1057,10 @@ export class ForwarderContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ - [contractName: string]: ContractAbi; - }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); + const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {}; + for (const key of Object.keys(logDecodeDependencies)) { + logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi; + } return ForwarderContract.deployAsync( bytecode, abi, 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 8330779a82..9ce4a6ead1 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 @@ -722,9 +722,10 @@ export class IAssetProxyContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ - [contractName: string]: ContractAbi; - }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); + const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {}; + for (const key of Object.keys(logDecodeDependencies)) { + logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi; + } return IAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( 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 2c194a3c96..12c6712511 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts @@ -102,9 +102,10 @@ export class IValidatorContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ - [contractName: string]: ContractAbi; - }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); + const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {}; + for (const key of Object.keys(logDecodeDependencies)) { + logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi; + } return IValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( 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 83ca828c21..6f6152a5f4 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts @@ -94,9 +94,10 @@ export class IWalletContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ - [contractName: string]: ContractAbi; - }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); + const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {}; + for (const key of Object.keys(logDecodeDependencies)) { + logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi; + } return IWalletContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( 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 c9a8a30608..970bcfb255 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 @@ -914,9 +914,10 @@ export class MultiAssetProxyContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ - [contractName: string]: ContractAbi; - }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); + const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {}; + for (const key of Object.keys(logDecodeDependencies)) { + logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi; + } return MultiAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( 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 1ab8adfa20..5ea9180f47 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts @@ -633,9 +633,10 @@ export class OrderValidatorContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ - [contractName: string]: ContractAbi; - }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); + const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {}; + for (const key of Object.keys(logDecodeDependencies)) { + logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi; + } return OrderValidatorContract.deployAsync( bytecode, abi, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts b/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts index 5a48c87259..f54f912818 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts @@ -910,9 +910,10 @@ export class WETH9Contract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ - [contractName: string]: ContractAbi; - }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); + const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {}; + for (const key of Object.keys(logDecodeDependencies)) { + logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi; + } return WETH9Contract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( 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 ee6b43b77b..c35927eb5b 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts @@ -719,9 +719,10 @@ export class ZRXTokenContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ - [contractName: string]: ContractAbi; - }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); + const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {}; + for (const key of Object.keys(logDecodeDependencies)) { + logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi; + } return ZRXTokenContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( diff --git a/packages/abi-gen/test-cli/expected-output/typescript/abi_gen_dummy.ts b/packages/abi-gen/test-cli/expected-output/typescript/abi_gen_dummy.ts index fad08205fe..c9c07b007f 100644 --- a/packages/abi-gen/test-cli/expected-output/typescript/abi_gen_dummy.ts +++ b/packages/abi-gen/test-cli/expected-output/typescript/abi_gen_dummy.ts @@ -1035,9 +1035,10 @@ export class AbiGenDummyContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ - [contractName: string]: ContractAbi; - }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); + const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {}; + for (const key of Object.keys(logDecodeDependencies)) { + logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi; + } return AbiGenDummyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( diff --git a/packages/abi-gen/test-cli/expected-output/typescript/lib_dummy.ts b/packages/abi-gen/test-cli/expected-output/typescript/lib_dummy.ts index 56cb550cf5..4a22ff8143 100644 --- a/packages/abi-gen/test-cli/expected-output/typescript/lib_dummy.ts +++ b/packages/abi-gen/test-cli/expected-output/typescript/lib_dummy.ts @@ -44,9 +44,10 @@ export class LibDummyContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ - [contractName: string]: ContractAbi; - }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); + const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {}; + for (const key of Object.keys(logDecodeDependencies)) { + logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi; + } return LibDummyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync( diff --git a/packages/abi-gen/test-cli/expected-output/typescript/test_lib_dummy.ts b/packages/abi-gen/test-cli/expected-output/typescript/test_lib_dummy.ts index 8c898b358a..a0fc5dea55 100644 --- a/packages/abi-gen/test-cli/expected-output/typescript/test_lib_dummy.ts +++ b/packages/abi-gen/test-cli/expected-output/typescript/test_lib_dummy.ts @@ -124,9 +124,10 @@ export class TestLibDummyContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly = Object.entries(logDecodeDependencies).reduce<{ - [contractName: string]: ContractAbi; - }>((accumulator, [key, value]) => ({ ...{ [key]: value.compilerOutput.abi } }), {}); + const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {}; + for (const key of Object.keys(logDecodeDependencies)) { + logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi; + } return TestLibDummyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); } public static async deployAsync(